stackitcloud / yawol

yawol is a Load Balancer solution for OpenStack, based on the Kubernetes controller pattern.
Apache License 2.0
41 stars 5 forks source link

Fix context cancellation error and improve error reporting in LoadBalancer controller #303

Closed MichaelEischer closed 4 months ago

MichaelEischer commented 4 months ago

A plain Context canceled error without further context is not helpful. This PR adds a first round of error wrapping to the high-level functions in the LB controller. I've omitted adding error wrapping to all leaf functions so far.

Gophercloud 1.10 introduced context aware functions. For this, the existing providerClient.Context field and the passed in context are merged. However, in provider_client.go in function doRequest the merged context is canceled using defer. This prevents reading from the Body of the returned http.Response. When using the new context-aware functions, the merge is not used and therefore reading the result works.

As we cannot use the new context-aware functions everywhere, the only option is to downgrade gophercloud.