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

🐛 (kustomize/v2, go/v4): Fix incorrect generation of manifests under config/crd/patches. Previously, the /convert service patch was being generated for all webhooks instead of only for those with --conversion enabled. #4280

Merged

Conversation

camilamacedo86
Copy link
Member

Ensure config/crd/patches are only generated for CRDs that were created using kubebuilder create webhook --conversion, as these patches are specific to conversion configuration and not needed for other CRDs.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 1, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 1, 2024
@camilamacedo86 camilamacedo86 force-pushed the fix-conversion-webhooks branch from b25e97e to cc357ce Compare November 1, 2024 08:44
@camilamacedo86
Copy link
Member Author

This PR addresses a very small but blocking bug fix, which impacts other critical PRs, such as #4280.
Given the simplicity of this fix, the high volume of pending PRs needing support, and the lack of objections, I will proceed with merging this one to unblock further progress.

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 2, 2024
@camilamacedo86 camilamacedo86 changed the title 🐛 (kustomize/v2, go/v4): Generate config/crd/patches only for CRDs created with kubebuilder create webhook --conversion 🐛 (kustomize/v2, go/v4): fix wrong generation of manifests under config/crd/patches. Instead of generate manifests only for webhook --conversion it is generating the /convert service patch for any webhook Nov 2, 2024
@camilamacedo86 camilamacedo86 changed the title 🐛 (kustomize/v2, go/v4): fix wrong generation of manifests under config/crd/patches. Instead of generate manifests only for webhook --conversion it is generating the /convert service patch for any webhook 🐛 (kustomize/v2, go/v4): Fix incorrect generation of manifests under config/crd/patches. Previously, the /convert service patch was being generated for all webhooks instead of only for those with --conversion enabled. Nov 2, 2024
@camilamacedo86 camilamacedo86 removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 2, 2024
- path: patches/webhook_in_crew_captains.yaml
- path: patches/webhook_in_ship_destroyers.yaml
- path: patches/webhook_in_ship_cruisers.yaml
- path: patches/webhook_in_example.com_memcacheds.yaml
- path: patches/webhook_in_example.com_wordpresses.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

@camilamacedo86 is there any specific reason for keeping this webhook patch, here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the goal of this PR is to remove these patches. They should never be added or scaffolded, as they are only valid for a specific type of webhook (conversion). The issue is that they have been incorrectly generated for all webhooks, not just conversion webhooks.

For non-conversion webhooks, CA injection is already configured via config/default/kustomize (and conversion webhooks will be handled similarly in a follow-up PR).

This bug is a remnant from the legacy layout when older versions of Kustomize, which supported vars, were used.

@camilamacedo86 camilamacedo86 requested a review from TAM360 November 2, 2024 13:08
Copy link
Contributor

@TAM360 TAM360 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

…eate webhook --conversion

Ensure config/crd/patches are only generated for CRDs that were created using kubebuilder create webhook --conversion, as these patches are specific to conversion configuration and not needed for other CRDs.
@camilamacedo86 camilamacedo86 force-pushed the fix-conversion-webhooks branch from cc357ce to 01ff68b Compare November 2, 2024 13:18
@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 2, 2024
@k8s-ci-robot k8s-ci-robot merged commit 5f8342e into kubernetes-sigs:master Nov 2, 2024
24 checks passed
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.

3 participants