-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ Add custom path option for webhooks #4845
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Damien Dassieu <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: damsien The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @damsien. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
ValidatingWebhookCustomPath string | ||
|
||
// DefaultingWebhookCustomPath defines the custom path that will be used by the scaffolded defaulting webhooks | ||
DefaultingWebhookCustomPath string |
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.
That’s great work, thank you! 🎉
The implementation looks solid at a glance.
However, since this introduces API changes, I’ll need a bit more time to review it carefully and fully assess the impact.
A couple of things we should also make sure of before merging:
-
This should be compatible with the alpha generate command — we’ll likely need to include logic to ensure the project is re-scaffolded correctly with the new option.
-
It should also work seamlessly with the Helm charts plugin (helm.kubebuilder.io/v1-alpha) — could you confirm compatibility or add test coverage for that?
Thanks again for the contribution! I’ll follow up with a more detailed review soon.
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.
Thank you for your quick comment!
we’ll likely need to include logic to ensure the project is re-scaffolded correctly with the new option.
What do you mean by "the project is re-scaffolded"?
could you confirm compatibility or add test coverage for that?
I didn't test it with the helm chart plugin. Also, since I never worked with the helm plugin, I don't really know where to start to confirm the compatibility 😅. Could you please provide me the test file where I should write the new test?
I don't really understand where there should be an incompatibility with the helm plugin since my feature is only related to the webhook file that is created using the CLI (actually it only affects the content of the webhook file, and it does not scaffold any other file). The feature is not related at all with the delivery of the user's operator.
Closes #4295 ! This PR brings a way to configure custom webhook path for the defaulting and validating webhooks in the
kubebuilder
cli.Two new flags are added for the
kubebuilder create webhook
command:--defaulting-custom-path
&--validating-custom-path
. Both can be used independently.Usage:
When used, it will:
// +kubebuilder:webhook:path
go marker.WithValidatorCustomPath(...).
or/andWithDefaulterCustomPath(...).
to the webhook setuper function.Result from the example above: