✨ Add namespaceSelector and objectSelector to webhook markers#1339
✨ Add namespaceSelector and objectSelector to webhook markers#1339camilamacedo86 wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
dad1fdb to
752154a
Compare
|
@sbueringer @JoelSpeed WDYT? |
pkg/webhook/parser.go
Outdated
| // namespaceSelector=matchLabels~team=platform&matchExpressions~key=tier.operator=NotIn.values=system | ||
| // | ||
| // Operators: In, NotIn, Exists, DoesNotExist | ||
| // Syntax: ~ separates selector type, . separates fields, & combines selectors, | separates values |
There was a problem hiding this comment.
What if we just allowed the user to write a JSON object representing a namespace selector, rather than coming up with some complex syntax?
There was a problem hiding this comment.
Done. Good idea 👍
752154a to
7cd4915
Compare
7cd4915 to
3abcd99
Compare
3abcd99 to
9ed010f
Compare
9ed010f to
7b52289
Compare
c895a1b to
a26f666
Compare
Enables filtering webhooks by namespace and object labels to solve the webhook bootstrap problem and support namespace-scoped operators. Assisted-by: Cursor/Claude
a26f666 to
de97a6a
Compare
|
Hi @JoelSpeed and @sbueringer Thank you for the help all addressed. |
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: 91384a821bc53e82b333bcbae4a51c6aca4e9d84 |
| // | ||
| // // +kubebuilder:webhook:...,namespaceSelector=`{"matchLabels":{"webhook-enabled":"true"}}` | ||
| // // +kubebuilder:webhook:...,namespaceSelector=`{"matchExpressions":[{"key":"environment","operator":"In","values":["dev","staging","prod"]}]}` | ||
| NamespaceSelector string `marker:"namespaceSelector,optional"` |
There was a problem hiding this comment.
Can you instead of these two just add a patch marker that contains a strategic merge patch that will be applied over the rest of the webhook so any current and future field can be adjusted that way?
Enables filtering webhooks by namespace and object labels to solve the webhook bootstrap problem and support namespace-scoped operators. This markers will allow Kubebuilder abstracts the complexities.
Closes: #553 and #1338