kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

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

Open rtoma-pq opened this issue 3 years ago • 1 comments

Describe the bug

When I define multiple chart instances in helmCharts for same chart but with different versions, the first version defined is pulled and used for all instances.

Files that can reproduce the issue

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: podinfo

helmCharts:
  - name: podinfo
    repo: https://stefanprodan.github.io/podinfo
    version: 6.2.1
    releaseName: podinfo1
  - name: podinfo
    repo: https://stefanprodan.github.io/podinfo
    version: 6.1.8                                      # <------ same chart, different version
    releaseName: podinfo2

Expected output

For the supplied kustomization.yaml we should see two Deployment resources with different images, but we do not.

Actual output

For the supplied kustomization.yaml we see two Deployment resources with matching images.

To verify:

$ kustomize build --enable-helm | grep -E 'image:.*podinfo'
        image: ghcr.io/stefanprodan/podinfo:6.2.1
        image: ghcr.io/stefanprodan/podinfo:6.2.1

Versions

Kustomize version: 4.5.7

Helm version: 3.9.4

Platform

I don't believe it's relevant, but I am on Mac.

Additional context

Since kustomize has a --helm-command I wrote a wrapper to inspect the helm executions made by kustomize.

Here are the executions:

helm version -c --short
helm pull --untar --untardir ./charts --repo https://stefanprodan.github.io/podinfo podinfo --version 6.2.1
helm template podinfo1 ./charts/podinfo --values .../kustomize-helm-3061748730/podinfo-kustomize-values.yaml
helm version -c --short
helm template podinfo2 ./charts/podinfo --values .../kustomize-helm-3953294510/podinfo-kustomize-values.yaml

Observerations:

  • only 1 helm pull of the 1st version, untarred to unversioned path
  • two helm template execs on the unversioned chart location

I conclude this is not a Helm issue, but a Kustomize issue.

Suggested fix: add the version to the chart directory (eg podinfo-6.2.1) and use the versioned dir in the helm template execs.

Regards.

rtoma-pq avatar Sep 30 '22 14:09 rtoma-pq

@rtoma-pq: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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 avatar Sep 30 '22 14:09 k8s-ci-robot

/triage accepted

Kustomize caches the helm chart under a directory that just matches the chart name. It should also be storing the version in the cache directory name so that it can check if the version matches when it is updated, and also support this use case of having different chart versions.

natasha41575 avatar Dec 09 '22 17:12 natasha41575

Rather unfortunately we had to revert #4999 so I am reopening this. My bad for not catching the regression!

natasha41575 avatar May 09 '23 20:05 natasha41575

Rather unfortunately we had to revert #4999 so I am reopening this. My bad for not catching the regression!

Hi @natasha41575, do we have any updates on this?

redspart avatar Jul 12 '23 14:07 redspart

Details of why we had to revert the change are in https://github.com/kubernetes-sigs/kustomize/pull/4999#issuecomment-1538505328. We need to make sure that we don't modify the directory format of where the chart lives, as it breaks the workflow of users with local charts.

If someone wants to pick this up, please take care to look at the previous PR and why we had to revert it.

natasha41575 avatar Aug 18 '23 17:08 natasha41575

hi @natasha41575, I have just submitted a PR to fix #4999 as well this issue, Could you take a look at it? Thank you!

ardikabs avatar Aug 24 '23 15:08 ardikabs

@natasha41575 , i think we can close this as per https://github.com/kubernetes-sigs/kustomize/pull/5293

ardikabs avatar Nov 10 '23 17:11 ardikabs