Skip to content
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

🐛 (go/v4) resolve duplicate webhook name issue in multi-version API #4145

Merged

Conversation

camilamacedo86
Copy link
Member

Adjust webhook names for mutating and validating webhooks to avoid conflicts when creating multiple versions of the same API.

Closes: #4144

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 8, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 8, 2024
@camilamacedo86 camilamacedo86 force-pushed the fix-duplicate-markers branch 2 times, most recently from 4598b66 to e8d1476 Compare September 8, 2024 23:25
- Adjust webhook names for mutating and validating webhooks to avoid conflicts when creating multiple versions of the same API.
More info: kubernetes-sigs#4144
@@ -75,6 +75,8 @@ A webhook will automatically be served that calls this defaulting.
The `Default` method is expected to mutate the receiver, setting the defaults.
*/

// +kubebuilder:webhook:path=/mutate-batch-tutorial-kubebuilder-io-v1-cronjob,mutating=true,failurePolicy=fail,sideEffects=None,groups=batch.tutorial.kubebuilder.io,resources=cronjobs,verbs=create;update,versions=v1,name=mcronjob-v1.kb.io,admissionReviewVersions=v1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little newline bug here? Shouldn't the +kubebuilder directives be togeher?

Copy link
Member Author

@camilamacedo86 camilamacedo86 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One marker is for the Mutating Webhook, and the other is for the Validating Webhook. Each webhook is scaffolded with its respective code—one for mutation and the other for validation. So, it's not a bug. Either the scope of this PR is only sort out the bug. We cannot scaffold all with the same name , the names must be unique and because of this we are appending the version of the Kind on it.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, mogsie

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2024
@k8s-ci-robot k8s-ci-robot merged commit 7d96796 into kubernetes-sigs:master Sep 9, 2024
18 checks passed
@camilamacedo86
Copy link
Member Author

I am moving forward with this fix since we already have 1 LGTM, and it’s a small change. We also need to get this merged to properly auto-generate the multi-version tutorial.

Additionally, I plan to ensure that all tutorials and samples are properly generated and well tested through CI before we begin working on the initiative to decouple the webhooks from the API. This way, we can ensure everything continues to work smoothly after those changes.

@camilamacedo86 camilamacedo86 deleted the fix-duplicate-markers branch September 9, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate Webhook Names Generated When Scaffolding Multiple Versions of the Same API
3 participants