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

Fix using same helm chart with different versions #4999

Merged

Conversation

dlish
Copy link
Contributor

@dlish dlish commented Jan 25, 2023

Fixes #4813

When a helm chart version is specified it sets --untardir to include name-version i.e. charts/terraform-1.1.2.

If no version is specified the behavior stays the same in that it pulls the latest version with --untardir set to the charts directory ex.charts

Example

---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
helmCharts:
  - name: terraform
    releaseName: terraform-1
    namespace: terraform-1
    repo: https://helm.releases.hashicorp.com
  - name: terraform
    version: 1.1.1
    releaseName: terraform-2
    namespace: terraform-2
    repo: https://helm.releases.hashicorp.com
  - name: terraform
    version: 1.1.1
    releaseName: terraform-3
    namespace: terraform-3
    repo: https://helm.releases.hashicorp.com
  - name: terraform
    version: 1.1.2
    releaseName: terraform-4
    namespace: terraform-4
    repo: https://helm.releases.hashicorp.com

Running kustomize build --enable-helm produces the following in the charts directory

❯ tree -L 3 charts
charts
├── terraform
...
│   ├── Chart.yaml
...
│   ├── templates
...
│   └── values.yaml
├── terraform-1.1.1
│   ├── terraform
...
│   │   ├── Chart.yaml
...
│   │   ├── templates
...
│   │   └── values.yaml
│   └── terraform-1.1.1.tgz
├── terraform-1.1.2
│   ├── terraform
...
│   │   ├── Chart.yaml
...
│   │   ├── templates
...
│   │   └── values.yaml
│   └── terraform-1.1.2.tgz
└── terraform-1.1.2.tgz

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 25, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dlish / name: Dustin Lish (893d637)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 25, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @dlish!

It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. 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/kustomize 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 25, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @dlish. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 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 Jan 25, 2023
@dlish dlish changed the title Fix using same helm chart with different versions WIP: Fix using same helm chart with different versions Jan 26, 2023
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 26, 2023
@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.

@dlish dlish changed the title WIP: Fix using same helm chart with different versions Fix using same helm chart with different versions Jan 26, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 26, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 3, 2023
@natasha41575
Copy link
Contributor

When a helm chart version is specified it sets --untardir to include name-version i.e. charts/terraform-1.1.2.

If no version is specified the behavior stays the same in that it pulls the latest version with --untardir set to the charts directory ex.charts

I have not looked at the code yet but this sounds like correct behavior and will fix #4813 in the same way that I'd imagined fixing it.

/triage accepted
/ok-to-test

/cc @koba1t @annasong20 could one of you give this a review?

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 20, 2023
@koba1t
Copy link
Member

koba1t commented Mar 22, 2023

/assign koba1t

@dlish
Copy link
Contributor Author

dlish commented Mar 22, 2023

Looks like there's been a number of changes to the HelmChartInflationGenerator.go file since I initially opened. I'll work on getting this PR updated

@koba1t
Copy link
Member

koba1t commented Mar 22, 2023

Looks like there's been a number of changes to the HelmChartInflationGenerator.go file since I initially opened. I'll work on getting this PR updated

Thanks!
I'll wait for your update.

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Mar 22, 2023
@koba1t
Copy link
Member

koba1t commented Mar 22, 2023

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 22, 2023
@dlish dlish force-pushed the fix-same-chart-multiple-versions branch from 5962f10 to 936a14c Compare March 22, 2023 19:20
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 22, 2023
@dlish dlish force-pushed the fix-same-chart-multiple-versions branch from 34d979d to 380abb9 Compare March 31, 2023 22:16
@natasha41575 natasha41575 added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 5, 2023
@annasong20
Copy link
Contributor

/lgtm

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

/lgtm
/approve

Thank you so much for your contribution! Please feel free to reach out on the kubernetes slack if you are interested in picking up any other issues.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dlish, natasha41575

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 Apr 24, 2023
@k8s-ci-robot k8s-ci-robot merged commit 0f244a4 into kubernetes-sigs:master Apr 24, 2023
@seh
Copy link
Contributor

seh commented May 7, 2023

Did the behavior change here so that now kustomize always has Helm download a tar archive, even if the charts directory already exists, populated with the content of the tar archive? Before version 5.0.2, kustomize wouldn't try to download that archive again.

I find that if I download and then place the tar archive where helm pull would put it, then the command fails, because the file already exists.

@seh
Copy link
Contributor

seh commented May 8, 2023

Ah, the Chart.yaml file now sits one directory component deeper, with the containing directory tree looking like the following:

charts
├── BUILD.bazel
└── minecraft-3.1.4
    └── minecraft
        ├── Chart.yaml
        ├── ...
        └── values.yaml

@dlish, what motivates repeating the chart name in the minecraft directory within the minecraft-3.1.4 directory?

seh added a commit to bisontrails/rules_kustomize that referenced this pull request May 8, 2023
Introduce version 5.0.2, and make that the default version. Remove
version 4.5.5.

Accommodate kubernetes-sigs/kustomize#4999 by relocating the extracted
Helm chart in the unit test data, placing the directory one level
deeper within a new containing directory distinguishing the files for
each version.
natasha41575 added a commit that referenced this pull request May 9, 2023
FrenchBen pushed a commit to FrenchBen/kustomize that referenced this pull request Jul 20, 2023
ardikabs pushed a commit to ardikabs/kustomize that referenced this pull request Aug 24, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
ardikabs pushed a commit to ardikabs/kustomize that referenced this pull request Aug 26, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
ardikabs pushed a commit to ardikabs/kustomize that referenced this pull request Oct 4, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
ardikabs pushed a commit to ardikabs/kustomize that referenced this pull request Oct 5, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
ardikabs pushed a commit to ardikabs/kustomize that referenced this pull request Nov 1, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
antoooks pushed a commit to antoooks/kustomize that referenced this pull request Nov 21, 2023
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue kubernetes-sigs#4813

* Use if/else for readability, add version check to absChartHome
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

helmCharts does not support 1+ instances of same chart, with different versions
6 participants