-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Never let cluster-scoped resources skip webhooks #58185
Never let cluster-scoped resources skip webhooks #58185
Conversation
/lgtm |
Please update also the type docs https://github.com/sttts/kubernetes/blob/951962512b9cfe15b25e9c715a5f33f088854f97/staging/src/k8s.io/api/admissionregistration/v1beta1/types.go#L150. Then lgtm. |
[MILESTONENOTIFIER] Milestone Removed From Pull Request Important: This pull request was missing labels required for the v1.9 milestone for more than 3 days: priority: Must specify exactly one of |
9c8f402
to
b3d2dfa
Compare
@@ -196,7 +196,7 @@ type Webhook struct { | |||
// on whether the namespace for that object matches the selector. If the | |||
// object itself is a namespace, the matching is performed on | |||
// object.metadata.labels. If the object is other cluster scoped resource, | |||
// it is not subjected to the webhook. | |||
// it never skips the webhook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sttts PTAL. Sorry it has been off my radar for a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: another cluster scoped resource.
But I am no native speaker either @deads2k you are. Can you comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed with @cheftako that we should use "another" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
lgtm modulo the nit. /approve |
b3d2dfa
to
c80a7ee
Compare
Nit fixed. I'll self apply the lgtm. |
/retest |
/assign @lavalamp For the api Godoc changes. |
This is a breaking API change. I think at a minimum it needs an "action required" notice in the release notes. Anyone who has added a webhook for a cluster scoped resource and forgotten about it is going to be in for a surprise when they get this patch. I think I agree that this is a bug that should be fixed, but is it so urgent that we want to do it before adding some exception mechanism? |
No issue with adding "action required", but worrying about a case where someone created the config, tested it, realized it didn't work, didn't remove it, upgrades, and then gets upset that it starts working seems like an edge of an edge of an edge for a config that is already broken.
Adding an exception mechanism would be a backward compatible change. Having exceptions on cluster-scoped things is less obvious of a use-case since they're already privileged so there are likely to be fewer webhooks for them. I had thought about applying the same label selection scheme since the data is already present (labels on the object you're touching or its previous value), but I wouldn't have blocked this on it. |
I'm the last person to apply rules for their own sake, and I agree this should be very rare, but I still worry about whether people will trust our API stability guarantees when we're willing to break things like this. I won't block it if we add the action-required notice. I should write a blog post called "it's not safe to upgrade your cluster". |
Added "action required". Feel free to reword it. |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: caesarxuchao, lavalamp, sttts Associated issue: #57964 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
Fix #57964
This allows user write webhooks for cluster-scoped custom resources.
We still need to figure out how to selectively exempt cluster-scoped resources from webhooks to avoid bootstrapping deadlocks. For now, if a deadlock occurs, users can work around by first deleting the webhook configuration, then rebooting the webhook, then re-enabling the webhook configuration.