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

helm: add support for kube-version and add cli args for both kube-version and api-versions #5270

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

MrFreezeex
Copy link
Member

@MrFreezeex MrFreezeex commented Aug 14, 2023

Add basic --kube-version flag support and test and add Kustomize CLI args for both api-versions and kube-version

CLI args are useful since you could use one single kustomization file/helm chart for multiple clusters (which have different versions). Also it's easier to have those on the CLI if the user has some kind of tooling that will end up calling kustomize and that could pass those to Helm in the end (i.e.: ArgoCD is doing that for Helm so it could do that for Kustomize as well that will end up calling Helm).

Fixes #5112

@k8s-ci-robot
Copy link
Contributor

This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 14, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 14, 2023
@MrFreezeex MrFreezeex force-pushed the helm-kube-api branch 2 times, most recently from 5f25018 to 06c57a4 Compare August 14, 2023 22:39
@MrFreezeex
Copy link
Member Author

Hi @koba1t, sorry for the ping. Since I saw you reviewing the helm OCI PR and as this is also a helm related PR, do you think it would it be possible for you to take a look/review this PR as well whenever you can? 🙏

@imranismail
Copy link

Hi @cailynse, sorry for the ping. But can you have a look at this, it's a key piece that's blocking the use of modern helm charts.

@koba1t
Copy link
Member

koba1t commented Nov 1, 2023

/assign @koba1t

@koba1t
Copy link
Member

koba1t commented Nov 1, 2023

Hi @MrFreezeex
Thanks for your contribution!

Looks almost good, but I think more test cases.
Could you add any test for testing when output changes due to the kubeVersion being different?

@MrFreezeex
Copy link
Member Author

MrFreezeex commented Nov 1, 2023

Hi @MrFreezeex Thanks for your contribution!

Looks almost good, but I think more test cases. Could you add any test for testing when output changes due to the kubeVersion being different?

Hey, thanks for the review! Although I am not sure I understood what test you meant. Do you mean like a test when you pass both the CLI option to kustomize and kubeVersion to kustomization.yaml (like testing this code essentially: https://github.com/kubernetes-sigs/kustomize/pull/5270/files#diff-57d88298737665fc6e6ab73c724dc75158356f59786b9ce2335c150945b38f2fR63)?

@koba1t
Copy link
Member

koba1t commented Nov 2, 2023

@MrFreezeex

Do you mean like a test when you pass both the CLI option to kustomize and kubeVersion to kustomization.yaml

Hmm, I think we should add a test that covers such cases.

But I want to add any tests to check when the KubeVersion parameter changes. I think looks like it only tests for v1.27.
https://github.com/kubernetes-sigs/kustomize/pull/5270/files#diff-29c329264899fb54b29d61bc6f9a5db64d559c4c428c5ffafbc2bb76e43a1307R20
I think it better to check the output after exec helm template than to test the passing parameter. If you can, Could you change that?

@MrFreezeex
Copy link
Member Author

MrFreezeex commented Nov 2, 2023

Do you mean like a test when you pass both the CLI option to kustomize and kubeVersion to kustomization.yaml

Hmm, I think we should add a test that covers such cases.

Sure I can take a look 👍

But I want to add any tests to check when the KubeVersion parameter changes. I think looks like it only tests for v1.27. https://github.com/kubernetes-sigs/kustomize/pull/5270/files#diff-29c329264899fb54b29d61bc6f9a5db64d559c4c428c5ffafbc2bb76e43a1307R20 I think it better to check the output after exec helm template than to test the passing parameter. If you can, Could you change that?

Hmm well I can do that but such test would be testing directly helm rather than a kustomize feature. In the tests of kustomize I currently test that if you pass kubeVersion it correctly set the appropriate helm flag & that if it's not set it doesn't pass the flag.

Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
It makes sense to add that as a CLI args since you could use one single
kustomization file/helm chart for multiple clusters. Also it's easier to
have those on the CLI if the user has some kind of tooling that will end
up calling kustomize and that could pass those (i.e.: ArgoCD is doing
that for Helm so it could do that for Kustomize as well that will end up
calling Helm as well).

Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
@MrFreezeex
Copy link
Member Author

Actually there is one for apiversions as well even though it doesn't test much, will check how to do that 👍

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 2, 2023
@MrFreezeex
Copy link
Member Author

MrFreezeex commented Nov 2, 2023

I added a new test with two different kubeVersion that make some change to the ingress group (networking.k8s.io/v1beta1 vs networking.k8s.io/v1) I believe that's what you were looking for?

Copy link
Member

@koba1t koba1t left a comment

Choose a reason for hiding this comment

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

Thanks @MrFreezeex
I added one minor suggestion for a test case.
Please check this.


th.WriteK(th.GetRoot(), `
namespace: default
helmCharts:
Copy link
Member

Choose a reason for hiding this comment

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

Looks like two helms generating one time.
So, I think I prefer generating one helmCharts two times in this case due to eliminate side effects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I think I did what you wanted! Let me know 👍

Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
Copy link
Member

@koba1t koba1t left a comment

Choose a reason for hiding this comment

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

@MrFreezeex
Thanks for your contribution!

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: koba1t, MrFreezeex

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2023
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
Development

Successfully merging this pull request may close these issues.

Introduce Support for kube-version Parameter for Consuming Helm Charts Relying on Capabilities
4 participants