-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add --custom-path flag for webhook creation #5158
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
Conversation
|
Hi @Copilot. Thanks for your PR. I'm waiting for a github.com 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. |
Co-authored-by: camilamacedo86 <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Copilot 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Copilot 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 |
Co-authored-by: camilamacedo86 <[email protected]>
Co-authored-by: camilamacedo86 <[email protected]>
Co-authored-by: camilamacedo86 <[email protected]>
|
@copilot rebase it with the master and read the AGENTS.md |
Done! Rebased on master (commit 271effe). Following AGENTS.md guidelines:
The implementation adds a Latest commit: c35af1e |
|
I will re-open other to test out |
Summary
Implements support for custom webhook paths via a new
--custom-pathflag inkubebuilder create webhook, addressing #4239.Changes Made
Modified Files (4 files, 43 insertions, 3 deletions)
pkg/model/resource/webhooks.go- AddedPathfield toWebhooksstructpkg/plugins/golang/options.go- AddedCustomWebhookPathtoOptionspkg/plugins/golang/v4/webhook.go- Added--custom-pathflag with validationpkg/plugins/golang/v4/scaffolds/internal/templates/webhooks/webhook.go- Updated templatesCompleted Tasks
make generateandmake test-unit/, no whitespace)Usage
Works with all webhook types. Fully backward compatible.
Original prompt
This section details on the original issue you should resolve
<issue_title>Custom path for webhooks</issue_title>
<issue_description>### What do you want to happen?
Hello, I'm coming here to talk about these closed issues #1436 & #1333 that were considered as a bug.
The issue is the following: when I generate the webhook file with
kubebuilder create api, an annotation is automatically generated in this form://+kubebuilder:webhook:path=/validate-xxx-xxx-v1-xxx,mutating=false,.... This annotation can make the developer think that he can actually modify the path (which is not the case as explained here).The previous issues where blocked mostly because the
controller-runtimeproject didn't implement the custom path feature. However, I recently made a PR that have been merged. This PR adds the ability for the developer to choose to use a custom path for his webhooks.My idea here is to let the developer choose a custom path if he wants to in his
kubebuilderproject. This choice will be made only when calling the creation command (kubebuilder create webhook) with a--custom-pathflag. By using this flag,kubebuilderwill generate an annotation including the custom path of the developer (//+kubebuilder:webhook:path=/my-custom-path,mutating=false,...).If this feature is accepted, I would like to work on this issue.
Extra Labels
No response</issue_description>
<agent_instructions># AGENTS.md
Kubebuilder
Project Overview
Kubebuilder is a framework and command-line interface (CLI) for building Kubernetes APIs using Custom Resource Definitions (CRDs).
It provides scaffolding and abstractions that accelerate the development of controllers, webhooks, and APIs written in Go.
sigs.k8s.io/kubebuilder/v4(requires Go ≥1.25)controller-runtime,controller-toolsCore Components
controller-runtime
controller-tools
make generate,make manifests, etc.Extensibility and Integrations
Architecture
pkg/plugins/golang/v4— scaffolds Go projectspkg/plugins/common/kustomize/v2— scaffolds theconfig/dir using Kustomizepkg/plugins/helm/v2-alpha— Helm-based operatorspkg/plugins/deploy-image— container image supportpkg/plugins/autoupdate/v1-alpha— upgrade automationRepository Layout
cmd/pkg/plugins/pkg/cli,pkg/machinery,pkg/model,pkg/internalhack/docs/generate.sh)docs/book/testdata/test/e2e/,features.sh)designs/✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.