✨ feat(webhook): Add patch field for webhook customization#1339
✨ feat(webhook): Add patch field for webhook customization#1339camilamacedo86 wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
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
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 |
pkg/webhook/parser.go
Outdated
| // | ||
| // // +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?
There was a problem hiding this comment.
Thank you for your input.
It is following your suggestion now.
Could you please give a look and let us know wdyt?
Could we get this one merged?
de97a6a to
482f624
Compare
|
New changes are detected. LGTM label has been removed. |
|
[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 |
Add a patch marker that applies strategic merge patches to webhooks, enabling configuration of namespaceSelector, objectSelector, and any other webhook field without requiring dedicated marker support. Assisted-by: Cursor/Claude
482f624 to
ecfe894
Compare
|
@sbueringer @JoelSpeed @alvaroaleman All suggestions are addressed now. |
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