Skip to content

🛠️ add ignore flags for selective scaffolding in edit command #4889

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pabhi18
Copy link

@pabhi18 pabhi18 commented Jun 26, 2025

Description:

This PR introduces support for the following --ignore-* flags in the edit command of the Helm plugin, allowing selective scaffolding of chart files:

  • --ignore-samples
  • --ignore-prometheus
  • --ignore-networkPolicy
  • --ignore-certmanager
  • --ignore-webhook

It can be used like this:

kubebuilder edit --plugins=helm.kubebuilder.io/v1-alpha \
  --ignore-samples \
  --ignore-prometheus \
  --ignore-networkPolicy \
  --ignore-certmanager \
  --ignore-webhook

These flags only apply to the edit command. The init command still scaffolds all components by default.
If any of the scaffolded folders are deleted manually, running edit with the respective --ignore-* flag will prevent them from being regenerated.

Motivation:

Developers may not want all default Helm chart components (like Prometheus monitors or sample CRs). This change offers a way to skip unwanted parts cleanly.

Fixes:

Fixes #4326

Copy link

linux-foundation-easycla bot commented Jun 26, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pabhi18
Once this PR has been reviewed and has the lgtm label, please assign camilamacedo86 for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @pabhi18!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @pabhi18. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 26, 2025
"ignore-networkPolicy": false,
"ignore-certmanager": false,
"ignore-webhook": false,
}
Copy link
Member

@camilamacedo86 camilamacedo86 Jun 26, 2025

Choose a reason for hiding this comment

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

To make this work, we’d need to ensure that we have none conditions using them in the scaffold as well.
For example, see the values.ymal and the other helm templates, we have conditions that check if has webhooks and etc.. handling those isn’t as straightforward as it seems.

I know we opened an issue about this in the past, but I’m not sure how feasible or maintainable it is long-term. We’d also need a way to validate and guarantee support across all options.

If we go ahead with this, we should: ( we cannot add the options without ensure that all works and is done as expected in each case )

  • Cover all relevant scaffold points
  • Add CI tests to validate configs for each scenario
  • Mock Helm charts and install them during e2e to catch issues early

We could follow the same pattern used in our e2e tests: create mocks per case, deploy them, and verify outcomes. See e2e/go/v4 and related GitHub Actions as reference.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the clarification!
Yes, currently the flags only prevent the files from being regenerated, but the corresponding checks in values.yaml and templates still need to be handled.
I’ll start working on adding the necessary conditions for those.
If you have any suggestions or references for adding those conditions or e2e tests, it would really help me a lot!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2025
@k8s-ci-robot
Copy link
Contributor

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

(helm/v1-alpha) Add ignore flags when generating charts
3 participants