Support for ignoring bad response from mutating admissions webhook #129459
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
sig/api-machinery
Categorizes an issue or PR as relevant to SIG API Machinery.
What would you like to be added?
Currently, you can configure the kubernetes control plane to ignore errors when calling a mutating admission webhook
~ https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/mutating-webhook-configuration-v1/
This is great, as some webhooks are 'nice to have' rather than critical and I do not want their failure to block resource creation.
However, it seems as though
failurePolicy
only applies to errors calling the webhook, and not from handeling the response. For example, I created an (intentionally faulty) webhook that returns an invalid patch under certain conditions (specifically it tries to add an entry to/metadata/annotations
even if it does not exist). When I tried to create an appropriate pod, I got an error response, even though I had set this webhook to have anIgnore
failure policy. e.g.I had a look through the source and I think this might be where the decision is being made about which errors to fail open for.
kubernetes/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/dispatcher.go
Lines 204 to 214 in 35f5841
It would be great if there was some way to tell kubernetes to ignore invalid responses (as well as errors calling the webhook). Of course, if there is already a way to do this, please do let me know!
Why is this needed?
This would increase the safety of using a webhook.
The text was updated successfully, but these errors were encountered: