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 uncomment kustomize files config accordinly when webhooks are generate #3629

Merged

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Sep 17, 2023

Description

We should NOT let the webhook configuration be commented on when a webhook is created. Therefore, this PR ensures that when we run kubebuilder to create a webhook we will uncomment the required places under the config so that webhooks are enabled by default.

@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 Sep 17, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 17, 2023
@camilamacedo86 camilamacedo86 changed the title 🐛 fix: uncomment kustomize files when webhooks are generate 🐛 (kustomize/v2,go/v4): fix uncomment kustomize files config accordinly when webhooks are generate Sep 17, 2023
@camilamacedo86 camilamacedo86 changed the title 🐛 (kustomize/v2,go/v4): fix uncomment kustomize files config accordinly when webhooks are generate 🐛 (WIP) (kustomize/v2,go/v4): fix uncomment kustomize files config accordinly when webhooks are generate Sep 17, 2023
- path: patches/webhook_in_ship_destroyers.yaml
- path: patches/webhook_in_ship_cruisers.yaml
- path: patches/webhook_in_sea-creatures_krakens.yaml
- path: patches/webhook_in_sea-creatures_leviathans.yaml
#- path: patches/webhook_in_foo.policy_healthcheckpolicies.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

The root cause here seems unrelated to the scope of this PR : #3630

Those that are not comment is because where created with the command create api when they should not be created in the first place.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @Sajiyah-Salat,

Also, as you have said, the issue is out of the scope of this PR. Could you let me know what we can address in a follow-up PR?
Regards: PR Discussion

In the sample project which is using a multi-group layout, we can see that some patches were not uncommented.
Why does this happen?
Because those patches should not exist in the first place.
They have been created when we run create api, but should only be created in specific scenarios, those when we run webhook create. The change of this PR is in the webhook subcommands, therefore, it is not reflected in this case scenario.

However, since the bug found is not part of the context of this PR, I would like to refer to the issue created. I think there is a better place to discuss this. #3630

@camilamacedo86 camilamacedo86 added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 17, 2023
@camilamacedo86 camilamacedo86 changed the title 🐛 (WIP) (kustomize/v2,go/v4): fix uncomment kustomize files config accordinly when webhooks are generate 🐛 (kustomize/v2,go/v4): fix uncomment kustomize files config accordinly when webhooks are generate Sep 17, 2023
@Sajiyah-Salat
Copy link
Contributor

I understood the issue. Can you please let me know how can I test this changes and know more about it. Also as you have said the issue is out of scope of this pr. So could you let me know what we can do in follow up pr.

@camilamacedo86
Copy link
Member Author

camilamacedo86 commented Sep 23, 2023

Hi @Sajiyah-Salat,

I understood the issue. Can you please let me know how I can test these changes and learn more about them?

The goal of this PR is to uncomment the kustomize files to enable webhooks when webhooks are scaffolded (kubectl webhook create). The e2e tests are testing the changes, you can check the code source and the changes made here to see that. Also, you can create a project, then create a webhook with the source code of this PR and ensure that the respective info commented will be uncommented at the end.

Also as you have said the issue is out of scope of this pr. So could you let me know what we can do in follow up pr.

See; #3629 (comment)

Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [camilamacedo86,varshaprasad96]

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

@k8s-ci-robot k8s-ci-robot merged commit 1a9d0ea into kubernetes-sigs:master Sep 27, 2023
21 checks passed
@camilamacedo86 camilamacedo86 deleted the fix-webhook-kustomize branch September 30, 2023 22:41
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants