grafana / rollout-operator

Kubernetes Rollout Operator
Apache License 2.0
132 stars 17 forks source link

Handle the context in webhook #75

Open MichelHollands opened 1 year ago

MichelHollands commented 1 year ago

This will stop the request from adding an annotation to the statefulset if the context is cancelled.

colega commented 1 year ago

It is usually unneeded to add the ctx.Done() check in the code that is not doing something that should be immediately interrupted. Why do we need it here? It seems that all kubernetes client calls already have the context provided, so I'd expect them to check it. Don't they?

MichelHollands commented 1 year ago

@colega Sorry, I should have left this as a draft PR. We are having a problem with the prepareDownscale webhook on AWS and Azure where it returns the HPA controller was unable to update the target scale: Operation cannot be fulfilled on statefulsets.apps "ingester -zone-a": the object has been modified; please apply your changes to the latest version and try again. This was a test to see if somehow multiple hooks updated the same object and caused the error.