-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🐛 Fix the CRD kustomization path logic to ensure webhook patches are generated exclusively for resources that are configured with webhooks #3838
Conversation
8f33559
to
e003fe3
Compare
/test pull-kubebuilder-e2e-k8s-1-26-6 |
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.
/lgtm
if !f.Resource.Webhooks.IsEmpty() { | ||
webhookPatch := make([]string, 0) | ||
// Change the line to uncomment the patch line | ||
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, suffix)) | ||
fragments[machinery.NewMarkerFor(f.Path, webhookPatchMarker)] = webhookPatch | ||
} |
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.
nit: does it make sense if we simplify the code lines like:
if !f.Resource.Webhooks.IsEmpty() { | |
webhookPatch := make([]string, 0) | |
// Change the line to uncomment the patch line | |
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, suffix)) | |
fragments[machinery.NewMarkerFor(f.Path, webhookPatchMarker)] = webhookPatch | |
} | |
if !f.Resource.Webhooks.IsEmpty() { | |
webhookPatch := fmt.Sprintf(webhookPatchCodeFragment, suffix) | |
fragments[machinery.NewMarkerFor(f.Path, webhookPatchMarker)] = []string{webhookPatch} | |
} |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, Kavinjsir 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 |
PR needs rebase. 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/test-infra repository. |
e003fe3
to
2caa380
Compare
…nerated exclusively for resources that are configured with webhooks
2caa380
to
8372976
Compare
/lgtm |
This PR addresses a bug in the generation process of the dist/installer for the testdata sample with multi-group layouts. Previously, the process incorrectly generated webhook patches for all resources, leading to failures in installer creation. With this update, webhook patches are now correctly generated only for resources that have webhooks configured, resolving the issue and ensuring successful generation of the installer.
Closes: #3761