-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ helm chart directory can be configured #4891
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
base: master
Are you sure you want to change the base?
✨ helm chart directory can be configured #4891
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bavarianbidi 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 |
Hi @bavarianbidi. 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 Once the patch is verified, the new status will be reflected by the 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. |
|
||
// Directory is the directory where the Helm chart will be scaffolded | ||
Directory string |
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.
I've also thought about adding a new machinery.HelmMixin
which could be used for all helm-based structs, but decided to not do it for now as i wanted your feedback on this first.
e4b1c05
to
4dc3596
Compare
@@ -66,6 +68,7 @@ manifests in the chart align with the latest changes. | |||
|
|||
func (p *editSubcommand) BindFlags(fs *pflag.FlagSet) { | |||
fs.BoolVar(&p.force, "force", false, "if true, regenerates all the files") | |||
fs.StringVar(&p.directory, "directory", HelmDefaultTargetDirectory, "domain for groups") |
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.
I think we need to as we do for the alpha generate.
I mean, use the name output-dir see
kubebuilder/docs/book/src/reference/rescaffold.md
Lines 28 to 32 in 202a630
Currently, it supports two optional params, `input-dir` and `output-dir`. | |
`input-dir` is the path to the existing project that you want to re-scaffold. Default is the current working directory. | |
`output-dir` is the path to the directory where you want to generate the new project. Default is a subdirectory in the current working directory. |
Consistency is the key :-)
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.
output-dir
as parameter-name for the helm-plugin will became an issue for alpha generate
.
As output-dir
is a parameter for alpha generate
we can't identify if a user defined output-dir
for the generate
or the helm
plugin.
I currently see the following options:
- use
output-dir
as flag for the helm-plugin, and introduce an additional flag foralpha generate
(e.g.--helm-output-dir
where the value is getting propagated into the--output-dir
ofkubebuilder alpha generate --plugins=helm/v1-alpha --output-dir=<value>
- use
output-dir
as flag for the helm-plugin and use the default-value ofdist
whenkubebuilder alpha generate --plugins=helm/v1-alpha
is getting called (user can still later do ankubebuilder edit --plugins=helm/v1-alpha --directory=<alternative dir>
if they are not happy with the default> - introduce
helm-output-dir
as flag all over the place (alpha generate
andedit --plugins=helm/v1-alpha
)
with the argument of consistency, i would prefer the last one.
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.
Hi @bavarianbidi it should not be an issue for alpha generate because it will re-scaffold what is configured in the PROJECT file.
If we add this option to helm, the input will be in the config with the path used
We need supplement alpha generate for call the new flag with the plugin value, and all will work out.
@@ -13,6 +13,7 @@ linters: | |||
- goconst |
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.
We will need to add a test to ensure all helm plugin options are set.
I haven't thought of the best way yet.
However, I think we might want to add e2e tests , similar to the others https://github.com/kubernetes-sigs/kubebuilder/tree/master/test/e2e ,to mock scenarios with helm and verify that everything is as expected.
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.
regarding e2e:
do you mean, my introduced changes in the e2e-tests aren't sufficient?
- https://github.com/kubernetes-sigs/kubebuilder/pull/4891/files#diff-cf2922923a38b0c2f4b62c6feb508f914d9c4e2ff6b0971d9b3e92f38166a5e9
- https://github.com/kubernetes-sigs/kubebuilder/pull/4891/files#diff-c0980e8e998bffb85cee1a67011d9c06ddecfbc5c0e48fcf6d3685f46f663004
do you want me to introduce a new e2e-test with a custom value for the helm output dir?
In the current impl. even the default-value will get persist in the PROJECT
file.
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.
I thought about this one and IMO:
1 - We need to add the new flag to the alpha generate
2 - We need to add a new mock in alpha generation that includes the Helm plugin and will utilise this option. Then, at the end, we validate that the helm chart was output in the directory path provided. That should be enough to cover both scenarios in the scope of this PR
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.
Please review how the alpha is generated and its associated tests. If you need a hand after that, please feel free to ping me in the Kubebuilder Slack channel. I am happy to help out.
waiting for #4901 |
The helm-plugin is meant to extend an existing go project. For a correct rendering of the helm-chart some information (like the project name) from the go project is needed. Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
as helm init got removed, renamed pkg/plugins/optional/helm/v1alpha/scaffolds/init.go -> pkg/plugins/optional/helm/v1alpha/scaffolds/edit.go also the NewInitHelmScaffolder func got renamed to NewHelmScaffolder Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
new minor cert-manager version will be used in testdata projects Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
Per default, helm-charts will get generated under dist/ directory. Via the newly introduced --directory flag it's now possible to define an alternative directory (e.g.: chart) fixes kubernetes-sigs#4320 Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
4dc3596
to
83fa3dd
Compare
Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages. The list of commits with invalid commit messages:
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. I understand the commands that are listed here. |
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. |
Per default, helm-charts will get generated under dist/ directory. Via the newly introduced --directory flag it's now possible to define an alternative directory (e.g.: chart)
fixes #4320
additional notes:
I've added a
importas
golangci rule for thehelmv1alpha
package as the import is handled in multiple files differently.If this is fine, i will also raise another PR to add at least two new importas-rules for
as it's super hard to read the code without having proper naming for equal sounded imports 😅