From a0f131cf864881a6ec08fba4e063cb6df842a35d Mon Sep 17 00:00:00 2001 From: Dustin Lish Date: Mon, 24 Apr 2023 16:09:02 -0600 Subject: [PATCH 1/6] Fix using same helm chart with different versions (#4999) * 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 #4813 * Use if/else for readability, add version check to absChartHome --- .../builtins/HelmChartInflationGenerator.go | 18 ++- .../HelmChartInflationGenerator.go | 18 ++- .../HelmChartInflationGenerator_test.go | 136 ++++++++++++++++++ 3 files changed, 166 insertions(+), 6 deletions(-) diff --git a/api/internal/builtins/HelmChartInflationGenerator.go b/api/internal/builtins/HelmChartInflationGenerator.go index e2a486e949..936ced3362 100644 --- a/api/internal/builtins/HelmChartInflationGenerator.go +++ b/api/internal/builtins/HelmChartInflationGenerator.go @@ -91,7 +91,12 @@ func (p *HelmChartInflationGeneratorPlugin) validateArgs() (err error) { // be under the loader root (unless root restrictions are // disabled). if p.ValuesFile == "" { - p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") + // If the version is specified, use the versioned values file. + if p.Version != "" { + p.ValuesFile = filepath.Join(p.ChartHome, fmt.Sprintf("%s-%s", p.Name, p.Version), p.Name, "values.yaml") + } else { + p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") + } } for i, file := range p.AdditionalValuesFiles { // use Load() to enforce root restrictions @@ -132,10 +137,17 @@ func (p *HelmChartInflationGeneratorPlugin) errIfIllegalValuesMerge() error { } func (p *HelmChartInflationGeneratorPlugin) absChartHome() string { + var chartHome string if filepath.IsAbs(p.ChartHome) { - return p.ChartHome + chartHome = p.ChartHome + } else { + chartHome = filepath.Join(p.h.Loader().Root(), p.ChartHome) + } + + if p.Version != "" { + return filepath.Join(chartHome, fmt.Sprintf("%s-%s", p.Name, p.Version)) } - return filepath.Join(p.h.Loader().Root(), p.ChartHome) + return chartHome } func (p *HelmChartInflationGeneratorPlugin) runHelmCommand( diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go index bca7fefade..394de7a98c 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go @@ -97,7 +97,12 @@ func (p *plugin) validateArgs() (err error) { // be under the loader root (unless root restrictions are // disabled). if p.ValuesFile == "" { - p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") + // If the version is specified, use the versioned values file. + if p.Version != "" { + p.ValuesFile = filepath.Join(p.ChartHome, fmt.Sprintf("%s-%s", p.Name, p.Version), p.Name, "values.yaml") + } else { + p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") + } } for i, file := range p.AdditionalValuesFiles { // use Load() to enforce root restrictions @@ -138,10 +143,17 @@ func (p *plugin) errIfIllegalValuesMerge() error { } func (p *plugin) absChartHome() string { + var chartHome string if filepath.IsAbs(p.ChartHome) { - return p.ChartHome + chartHome = p.ChartHome + } else { + chartHome = filepath.Join(p.h.Loader().Root(), p.ChartHome) + } + + if p.Version != "" { + return filepath.Join(chartHome, fmt.Sprintf("%s-%s", p.Name, p.Version)) } - return filepath.Join(p.h.Loader().Root(), p.ChartHome) + return chartHome } func (p *plugin) runHelmCommand( diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index 95ba98c618..aa181471a1 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/assert" kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" "sigs.k8s.io/kustomize/kyaml/copyutil" ) @@ -626,3 +627,138 @@ func copyTestChartsIntoHarness(t *testing.T, th *kusttest_test.HarnessEnhanced) require.NoError(t, copyutil.CopyDir(th.GetFSys(), chartDir, thDir)) } + +func TestHelmChartInflationGeneratorWithSameChartMultipleVersions(t *testing.T) { + th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t). + PrepBuiltin("HelmChartInflationGenerator") + defer th.Reset() + if err := th.ErrIfNoHelm(); err != nil { + t.Skip("skipping: " + err.Error()) + } + tests := []struct { + name string + chartName string + repo string + version string + releaseName string + }{ + { + name: "terraform chart with no version grabs latest", + chartName: "terraform", + repo: "https://helm.releases.hashicorp.com", + version: "", + releaseName: "terraform-latest", + }, + { + name: "terraform chart with version 1.1.1", + chartName: "terraform", + repo: "https://helm.releases.hashicorp.com", + version: "1.1.1", + releaseName: "terraform-1.1.1", + }, + { + name: "terraform chart with version 1.1.1 again", + chartName: "terraform", + repo: "https://helm.releases.hashicorp.com", + version: "1.1.1", + releaseName: "terraform-1.1.1-1", + }, + { + name: "terraform chart with version 1.1.2", + chartName: "terraform", + repo: "https://helm.releases.hashicorp.com", + version: "1.1.2", + releaseName: "terraform-1.1.2", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + config := fmt.Sprintf(` +apiVersion: builtin +kind: HelmChartInflationGenerator +metadata: + name: %s +name: %s +version: %s +repo: %s +releaseName: %s +`, tt.chartName, tt.chartName, tt.version, tt.repo, tt.releaseName) + + rm := th.LoadAndRunGenerator(config) + assert.True(t, len(rm.Resources()) > 0) + + var chartDir string + if tt.version != "" { + chartDir = fmt.Sprintf("charts/%s-%s/%s", tt.chartName, tt.version, tt.chartName) + } else { + chartDir = fmt.Sprintf("charts/%s", tt.chartName) + } + + d, err := th.GetFSys().ReadFile(filepath.Join(th.GetRoot(), chartDir, "Chart.yaml")) + if err != nil { + t.Fatal(err) + } + + assert.Contains(t, string(d), fmt.Sprintf("name: %s", tt.chartName)) + if tt.version != "" { + assert.Contains(t, string(d), fmt.Sprintf("version: %s", tt.version)) + } + }) + } +} + +// Test that verifies +1 instances of same chart with different versions +// https://github.com/kubernetes-sigs/kustomize/issues/4813 +func TestHelmChartInflationGeneratorWithMultipleInstancesSameChartDifferentVersions(t *testing.T) { + th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t). + PrepBuiltin("HelmChartInflationGenerator") + defer th.Reset() + if err := th.ErrIfNoHelm(); err != nil { + t.Skip("skipping: " + err.Error()) + } + + podinfo1 := th.LoadAndRunGenerator(` +apiVersion: builtin +kind: HelmChartInflationGenerator +metadata: + name: podinfo +name: podinfo +version: 6.2.1 +repo: https://stefanprodan.github.io/podinfo +releaseName: podinfo1 +`) + + podinfo2 := th.LoadAndRunGenerator(` +apiVersion: builtin +kind: HelmChartInflationGenerator +metadata: + name: podinfo +name: podinfo +version: 6.1.8 +repo: https://stefanprodan.github.io/podinfo +releaseName: podinfo2 +`) + + podinfo1Img, err := podinfo1.Resources()[1].GetFieldValue("spec.template.spec.containers.0.image") + assert.NoError(t, err) + assert.Equal(t, "ghcr.io/stefanprodan/podinfo:6.2.1", podinfo1Img) + + podinfo2Img, err := podinfo2.Resources()[1].GetFieldValue("spec.template.spec.containers.0.image") + assert.NoError(t, err) + assert.Equal(t, "ghcr.io/stefanprodan/podinfo:6.1.8", podinfo2Img) + + podinfo1ChartsDir := filepath.Join(th.GetRoot(), "charts/podinfo-6.2.1/podinfo") + assert.True(t, th.GetFSys().Exists(podinfo1ChartsDir)) + + podinfo2ChartsDir := filepath.Join(th.GetRoot(), "charts/podinfo-6.1.8/podinfo") + assert.True(t, th.GetFSys().Exists(podinfo2ChartsDir)) + + podinfo1ChartContents, err := th.GetFSys().ReadFile(filepath.Join(podinfo1ChartsDir, "Chart.yaml")) + assert.NoError(t, err) + assert.Contains(t, string(podinfo1ChartContents), "version: 6.2.1") + + podinfo2ChartContents, err := th.GetFSys().ReadFile(filepath.Join(podinfo2ChartsDir, "Chart.yaml")) + assert.NoError(t, err) + assert.Contains(t, string(podinfo2ChartContents), "version: 6.1.8") +} From cc35d3c4e566d5d4bd622590f43c76a3afae1bb4 Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Thu, 24 Aug 2023 22:18:16 +0700 Subject: [PATCH 2/6] fix: fix while using local charts with version fix https://github.com/kubernetes-sigs/kustomize/issues/5163 Signed-off-by: Ardika Bagus --- .../builtins/HelmChartInflationGenerator.go | 9 +-- .../HelmChartInflationGenerator.go | 9 +-- .../HelmChartInflationGenerator_test.go | 62 ++++++++++++++++++- 3 files changed, 65 insertions(+), 15 deletions(-) diff --git a/api/internal/builtins/HelmChartInflationGenerator.go b/api/internal/builtins/HelmChartInflationGenerator.go index 936ced3362..40437a2155 100644 --- a/api/internal/builtins/HelmChartInflationGenerator.go +++ b/api/internal/builtins/HelmChartInflationGenerator.go @@ -91,12 +91,7 @@ func (p *HelmChartInflationGeneratorPlugin) validateArgs() (err error) { // be under the loader root (unless root restrictions are // disabled). if p.ValuesFile == "" { - // If the version is specified, use the versioned values file. - if p.Version != "" { - p.ValuesFile = filepath.Join(p.ChartHome, fmt.Sprintf("%s-%s", p.Name, p.Version), p.Name, "values.yaml") - } else { - p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") - } + p.ValuesFile = filepath.Join(p.absChartHome(), p.Name, "values.yaml") } for i, file := range p.AdditionalValuesFiles { // use Load() to enforce root restrictions @@ -144,7 +139,7 @@ func (p *HelmChartInflationGeneratorPlugin) absChartHome() string { chartHome = filepath.Join(p.h.Loader().Root(), p.ChartHome) } - if p.Version != "" { + if p.Version != "" && p.Repo != "" { return filepath.Join(chartHome, fmt.Sprintf("%s-%s", p.Name, p.Version)) } return chartHome diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go index 394de7a98c..01adb29f5b 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go @@ -97,12 +97,7 @@ func (p *plugin) validateArgs() (err error) { // be under the loader root (unless root restrictions are // disabled). if p.ValuesFile == "" { - // If the version is specified, use the versioned values file. - if p.Version != "" { - p.ValuesFile = filepath.Join(p.ChartHome, fmt.Sprintf("%s-%s", p.Name, p.Version), p.Name, "values.yaml") - } else { - p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml") - } + p.ValuesFile = filepath.Join(p.absChartHome(), p.Name, "values.yaml") } for i, file := range p.AdditionalValuesFiles { // use Load() to enforce root restrictions @@ -150,7 +145,7 @@ func (p *plugin) absChartHome() string { chartHome = filepath.Join(p.h.Loader().Root(), p.ChartHome) } - if p.Version != "" { + if p.Version != "" && p.Repo != "" { return filepath.Join(chartHome, fmt.Sprintf("%s-%s", p.Name, p.Version)) } return chartHome diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index aa181471a1..da504e0e1f 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -670,6 +670,12 @@ func TestHelmChartInflationGeneratorWithSameChartMultipleVersions(t *testing.T) version: "1.1.2", releaseName: "terraform-1.1.2", }, + { + name: "terraform chart with version 1.1.2 but without repo", + chartName: "terraform", + version: "1.1.2", + releaseName: "terraform-1.1.2", + }, } for _, tt := range tests { @@ -689,12 +695,14 @@ releaseName: %s assert.True(t, len(rm.Resources()) > 0) var chartDir string - if tt.version != "" { + if tt.version != "" && tt.repo != "" { chartDir = fmt.Sprintf("charts/%s-%s/%s", tt.chartName, tt.version, tt.chartName) } else { chartDir = fmt.Sprintf("charts/%s", tt.chartName) } + fmt.Printf("%s: %s\n", tt.name, chartDir) + d, err := th.GetFSys().ReadFile(filepath.Join(th.GetRoot(), chartDir, "Chart.yaml")) if err != nil { t.Fatal(err) @@ -761,4 +769,56 @@ releaseName: podinfo2 podinfo2ChartContents, err := th.GetFSys().ReadFile(filepath.Join(podinfo2ChartsDir, "Chart.yaml")) assert.NoError(t, err) assert.Contains(t, string(podinfo2ChartContents), "version: 6.1.8") + +} + +// Addressed: https://github.com/kubernetes-sigs/kustomize/issues/5163 +func TestHelmChartInflationGeneratorWithLocalChartWithVersion(t *testing.T) { + th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t). + PrepBuiltin("HelmChartInflationGenerator") + defer th.Reset() + if err := th.ErrIfNoHelm(); err != nil { + t.Skip("skipping: " + err.Error()) + } + + th.GetFSys().MkdirAll(filepath.Join(th.GetRoot(), "charts/dummy/templates")) + th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/Chart.yaml"), ` +apiVersion: v1 +appVersion: 1.0.0 +description: Dummy +name: dummy +version: 1.0.0 +`) + + th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/values.yaml"), ` +foo: bar +`) + + th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/templates/cm.yaml"), ` +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.foo }} +`) + + dummyInlineHelmChart := th.LoadAndRunGenerator(` +apiVersion: builtin +kind: HelmChartInflationGenerator +metadata: + name: dummy +name: dummy +version: 1.0.0 +releaseName: dummy +`) + + dummyConfigmap, err := dummyInlineHelmChart.Resources()[0].GetFieldValue("metadata.name") + assert.NoError(t, err) + assert.Equal(t, "bar", dummyConfigmap) + + dummyChartsDir := filepath.Join(th.GetRoot(), "charts/dummy") + assert.True(t, th.GetFSys().Exists(dummyChartsDir)) + + dummyChartsContent, err := th.GetFSys().ReadFile(filepath.Join(dummyChartsDir, "Chart.yaml")) + assert.NoError(t, err) + assert.Contains(t, string(dummyChartsContent), "version: 1.0.0") } From 5505af439a959cf30f28b71e20359701a2ea3546 Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Wed, 30 Aug 2023 23:24:30 +0700 Subject: [PATCH 3/6] chore: fix lint, assert with required --- .../HelmChartInflationGenerator_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index da504e0e1f..0ffe914734 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" "sigs.k8s.io/kustomize/kyaml/copyutil" ) @@ -781,7 +782,9 @@ func TestHelmChartInflationGeneratorWithLocalChartWithVersion(t *testing.T) { t.Skip("skipping: " + err.Error()) } - th.GetFSys().MkdirAll(filepath.Join(th.GetRoot(), "charts/dummy/templates")) + err := th.GetFSys().MkdirAll(filepath.Join(th.GetRoot(), "charts/dummy/templates")) + require.NoError(t, err) + th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/Chart.yaml"), ` apiVersion: v1 appVersion: 1.0.0 From b7b85b10fc9fd229fc86069eac055fb99c94218c Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Wed, 4 Oct 2023 20:44:10 +0700 Subject: [PATCH 4/6] chore: remove unnecessary code, and using testdata instead of inline Signed-off-by: Ardika Bagus --- go.work.sum | 41 ++-------------- .../HelmChartInflationGenerator_test.go | 47 +++++-------------- .../testdata/charts/issue5163/Chart.yaml | 24 ++++++++++ .../charts/issue5163/templates/configmap.yaml | 4 ++ .../testdata/charts/issue5163/values.yaml | 1 + 5 files changed, 46 insertions(+), 71 deletions(-) create mode 100644 plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml create mode 100644 plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml create mode 100644 plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml diff --git a/go.work.sum b/go.work.sum index bba8f3fada..1af0794195 100644 --- a/go.work.sum +++ b/go.work.sum @@ -72,7 +72,6 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/flowstack/go-jsonschema v0.1.1 h1:dCrjGJRXIlbDsLAgTJZTjhwUJnnxVWl1OgNyYh5nyDc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= @@ -149,8 +148,6 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5 h1:58+kh9C6jJVXYjt8IE48G2eWl6BjwU5Gj0gqY84fy78= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= @@ -211,51 +208,21 @@ golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7 golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0= -gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 h1:OB/uP/Puiu5vS5QMRPrXCDWUPb+kt8f1KW8oQzFejQw= -gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts= -google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w= -google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 h1:Et6SkiuvnBn+SgrSYXs/BrUpGB4mbdwt4R3vaPIlicA= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/cheggaaa/pb.v1 v1.0.25 h1:Ev7yu1/f6+d+b3pi5vPdRPc6nNtP1umSfcWiEfRqv6I= -gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= -gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= -k8s.io/apiserver v0.17.0 h1:XhUix+FKFDcBygWkQNp7wKKvZL030QUlH1o8vFeSgZA= -k8s.io/code-generator v0.17.0 h1:y+KWtDWNqlJzJu/kUy8goJZO0X71PGIpAHLX8a0JYk0= -k8s.io/component-base v0.17.0 h1:BnDFcmBDq+RPpxXjmuYnZXb59XNN9CaFrX8ba9+3xrA= -k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c h1:GohjlNKauSai7gN4wsJkeZ3WAJx4Sh+oT/b5IYn5suA= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ= -modernc.org/golex v1.0.0 h1:wWpDlbK8ejRfSyi0frMyhilD3JBvtcx2AdGDnU+JtsE= -modernc.org/mathutil v1.0.0 h1:93vKjrJopTPrtTNpZ8XIovER7iCIH1QU7wNbOQXC60I= -modernc.org/strutil v1.0.0 h1:XVFtQwFVwc02Wk+0L/Z/zDDXO81r5Lhe6iMKmGX3KhE= -modernc.org/xc v1.0.0 h1:7ccXrupWZIS3twbUGrtKmHS2DXY6xegFua+6O3xgAFU= -rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= -rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= -rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 h1:zD2IemQ4LmOcAumeiyDWXKUI2SO0NYDe3H6QGvPOVgU= diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index 0ffe914734..ea62c1917a 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -9,7 +9,6 @@ import ( "path/filepath" "testing" - "github.com/stretchr/testify/require" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" @@ -770,11 +769,10 @@ releaseName: podinfo2 podinfo2ChartContents, err := th.GetFSys().ReadFile(filepath.Join(podinfo2ChartsDir, "Chart.yaml")) assert.NoError(t, err) assert.Contains(t, string(podinfo2ChartContents), "version: 6.1.8") - } // Addressed: https://github.com/kubernetes-sigs/kustomize/issues/5163 -func TestHelmChartInflationGeneratorWithLocalChartWithVersion(t *testing.T) { +func TestHelmChartInflationGeneratorWithLocalChartWithVersion5163(t *testing.T) { th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t). PrepBuiltin("HelmChartInflationGenerator") defer th.Reset() @@ -782,46 +780,27 @@ func TestHelmChartInflationGeneratorWithLocalChartWithVersion(t *testing.T) { t.Skip("skipping: " + err.Error()) } - err := th.GetFSys().MkdirAll(filepath.Join(th.GetRoot(), "charts/dummy/templates")) - require.NoError(t, err) - - th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/Chart.yaml"), ` -apiVersion: v1 -appVersion: 1.0.0 -description: Dummy -name: dummy -version: 1.0.0 -`) - - th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/values.yaml"), ` -foo: bar -`) - - th.WriteF(filepath.Join(th.GetRoot(), "charts/dummy/templates/cm.yaml"), ` -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Values.foo }} -`) + copyTestChartsIntoHarness(t, th) - dummyInlineHelmChart := th.LoadAndRunGenerator(` + rm := th.LoadAndRunGenerator(` apiVersion: builtin kind: HelmChartInflationGenerator metadata: - name: dummy -name: dummy + name: issue5163 +name: issue5163 version: 1.0.0 -releaseName: dummy +releaseName: issue5163 +chartHome: ./charts `) - dummyConfigmap, err := dummyInlineHelmChart.Resources()[0].GetFieldValue("metadata.name") + cm, err := rm.Resources()[0].GetFieldValue("metadata.name") assert.NoError(t, err) - assert.Equal(t, "bar", dummyConfigmap) + assert.Equal(t, "bar", cm) - dummyChartsDir := filepath.Join(th.GetRoot(), "charts/dummy") - assert.True(t, th.GetFSys().Exists(dummyChartsDir)) + chartDir := filepath.Join(th.GetRoot(), "charts/issue5163") + assert.True(t, th.GetFSys().Exists(chartDir)) - dummyChartsContent, err := th.GetFSys().ReadFile(filepath.Join(dummyChartsDir, "Chart.yaml")) + chartYamlContent, err := th.GetFSys().ReadFile(filepath.Join(chartDir, "Chart.yaml")) assert.NoError(t, err) - assert.Contains(t, string(dummyChartsContent), "version: 1.0.0") + assert.Contains(t, string(chartYamlContent), "version: 1.0.0") } diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml new file mode 100644 index 0000000000..2fd90b40be --- /dev/null +++ b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: issue5163 +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "stable" diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml new file mode 100644 index 0000000000..b7c8ef451a --- /dev/null +++ b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.foo }} diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml new file mode 100644 index 0000000000..20e9ff3fea --- /dev/null +++ b/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml @@ -0,0 +1 @@ +foo: bar From 790dbf0fdfe35202c934f43aa2fdd0f0e3199978 Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Sat, 28 Oct 2023 11:20:28 +0700 Subject: [PATCH 5/6] chore: rename chart and test case with clear intention --- .../HelmChartInflationGenerator_test.go | 13 +++++++------ .../charts/{issue5163 => foo-chart}/Chart.yaml | 2 +- .../templates/configmap.yaml | 0 .../charts/{issue5163 => foo-chart}/values.yaml | 0 4 files changed, 8 insertions(+), 7 deletions(-) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{issue5163 => foo-chart}/Chart.yaml (98%) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{issue5163 => foo-chart}/templates/configmap.yaml (100%) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{issue5163 => foo-chart}/values.yaml (100%) diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index ea62c1917a..3ba3ad8a09 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -771,8 +771,8 @@ releaseName: podinfo2 assert.Contains(t, string(podinfo2ChartContents), "version: 6.1.8") } -// Addressed: https://github.com/kubernetes-sigs/kustomize/issues/5163 -func TestHelmChartInflationGeneratorWithLocalChartWithVersion5163(t *testing.T) { +// Reference: https://github.com/kubernetes-sigs/kustomize/issues/5163 +func TestHelmChartInflationGeneratorUsingVersionWithoutRepo(t *testing.T) { th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t). PrepBuiltin("HelmChartInflationGenerator") defer th.Reset() @@ -786,10 +786,10 @@ func TestHelmChartInflationGeneratorWithLocalChartWithVersion5163(t *testing.T) apiVersion: builtin kind: HelmChartInflationGenerator metadata: - name: issue5163 -name: issue5163 + name: foo-chart +name: foo-chart version: 1.0.0 -releaseName: issue5163 +releaseName: foo-chart chartHome: ./charts `) @@ -797,10 +797,11 @@ chartHome: ./charts assert.NoError(t, err) assert.Equal(t, "bar", cm) - chartDir := filepath.Join(th.GetRoot(), "charts/issue5163") + chartDir := filepath.Join(th.GetRoot(), "charts/foo-chart") assert.True(t, th.GetFSys().Exists(chartDir)) chartYamlContent, err := th.GetFSys().ReadFile(filepath.Join(chartDir, "Chart.yaml")) assert.NoError(t, err) + assert.Contains(t, string(chartYamlContent), "name: foo-chart") assert.Contains(t, string(chartYamlContent), "version: 1.0.0") } diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml similarity index 98% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml index 2fd90b40be..559af039b1 100644 --- a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/Chart.yaml +++ b/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: issue5163 +name: foo-chart description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/templates/configmap.yaml similarity index 100% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/templates/configmap.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/templates/configmap.yaml diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/values.yaml similarity index 100% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/issue5163/values.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/values.yaml From 6640f8799e38e9be297312b61acc5b26cbca2173 Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Sat, 28 Oct 2023 11:47:16 +0700 Subject: [PATCH 6/6] test: add Kustomize test case for multiple helm charts with different version Signed-off-by: Ardika Bagus --- .../helmchartinflationgenerator_test.go | 117 ++++++++++++++++++ .../HelmChartInflationGenerator_test.go | 10 +- .../{foo-chart => test-chart}/Chart.yaml | 4 +- .../templates/configmap.yaml | 0 .../{foo-chart => test-chart}/values.yaml | 0 5 files changed, 124 insertions(+), 7 deletions(-) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{foo-chart => test-chart}/Chart.yaml (95%) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{foo-chart => test-chart}/templates/configmap.yaml (100%) rename plugin/builtin/helmchartinflationgenerator/testdata/charts/{foo-chart => test-chart}/values.yaml (100%) diff --git a/api/krusty/helmchartinflationgenerator_test.go b/api/krusty/helmchartinflationgenerator_test.go index e57d8b83c4..daffa16a0a 100644 --- a/api/krusty/helmchartinflationgenerator_test.go +++ b/api/krusty/helmchartinflationgenerator_test.go @@ -567,6 +567,123 @@ metadata: `) } +// Reference: https://github.com/kubernetes-sigs/kustomize/issues/5163 +func TestHelmChartInflationGeneratorForMultipleChartsDifferentVersion(t *testing.T) { + th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t) + defer th.Reset() + if err := th.ErrIfNoHelm(); err != nil { + t.Skip("skipping: " + err.Error()) + } + + copyValuesFilesTestChartsIntoHarness(t, th) + + th.WriteK(th.GetRoot(), ` +namespace: default +helmCharts: + - name: test-chart + releaseName: test + version: 1.0.0 + skipTests: true + - name: minecraft + repo: https://itzg.github.io/minecraft-server-charts + version: 3.1.3 + releaseName: test-1 + - name: minecraft + repo: https://itzg.github.io/minecraft-server-charts + version: 3.1.4 + releaseName: test-2 +`) + + m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled()) + th.AssertActualEqualsExpected(m, ` +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + chart: test-1.0.0 + name: my-deploy + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: test + template: + spec: + containers: + - image: test-image:v1.0.0 + imagePullPolicy: Always +--- +apiVersion: v1 +data: + rcon-password: Q0hBTkdFTUUh +kind: Secret +metadata: + labels: + app: test-1-minecraft + chart: minecraft-3.1.3 + heritage: Helm + release: test-1 + name: test-1-minecraft + namespace: default +type: Opaque +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: test-1-minecraft + chart: minecraft-3.1.3 + heritage: Helm + release: test-1 + name: test-1-minecraft + namespace: default +spec: + ports: + - name: minecraft + port: 25565 + protocol: TCP + targetPort: minecraft + selector: + app: test-1-minecraft + type: ClusterIP +--- +apiVersion: v1 +data: + rcon-password: Q0hBTkdFTUUh +kind: Secret +metadata: + labels: + app: test-2-minecraft + chart: minecraft-3.1.4 + heritage: Helm + release: test-2 + name: test-2-minecraft + namespace: default +type: Opaque +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: test-2-minecraft + chart: minecraft-3.1.4 + heritage: Helm + release: test-2 + name: test-2-minecraft + namespace: default +spec: + ports: + - name: minecraft + port: 25565 + protocol: TCP + targetPort: minecraft + selector: + app: test-2-minecraft + type: ClusterIP +`) +} + func copyValuesFilesTestChartsIntoHarness(t *testing.T, th *kusttest_test.HarnessEnhanced) { t.Helper() diff --git a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go index 3ba3ad8a09..d75b44d1dc 100644 --- a/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go +++ b/plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go @@ -786,10 +786,10 @@ func TestHelmChartInflationGeneratorUsingVersionWithoutRepo(t *testing.T) { apiVersion: builtin kind: HelmChartInflationGenerator metadata: - name: foo-chart -name: foo-chart + name: test-chart +name: test-chart version: 1.0.0 -releaseName: foo-chart +releaseName: test chartHome: ./charts `) @@ -797,11 +797,11 @@ chartHome: ./charts assert.NoError(t, err) assert.Equal(t, "bar", cm) - chartDir := filepath.Join(th.GetRoot(), "charts/foo-chart") + chartDir := filepath.Join(th.GetRoot(), "charts/test-chart") assert.True(t, th.GetFSys().Exists(chartDir)) chartYamlContent, err := th.GetFSys().ReadFile(filepath.Join(chartDir, "Chart.yaml")) assert.NoError(t, err) - assert.Contains(t, string(chartYamlContent), "name: foo-chart") + assert.Contains(t, string(chartYamlContent), "name: test-chart") assert.Contains(t, string(chartYamlContent), "version: 1.0.0") } diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/Chart.yaml similarity index 95% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/Chart.yaml index 559af039b1..418a298771 100644 --- a/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/Chart.yaml +++ b/plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: foo-chart -description: A Helm chart for Kubernetes +name: test-chart +description: A simple test helm chart. # A chart can be either an 'application' or a 'library' chart. # diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/templates/configmap.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/templates/configmap.yaml similarity index 100% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/templates/configmap.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/templates/configmap.yaml diff --git a/plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/values.yaml b/plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/values.yaml similarity index 100% rename from plugin/builtin/helmchartinflationgenerator/testdata/charts/foo-chart/values.yaml rename to plugin/builtin/helmchartinflationgenerator/testdata/charts/test-chart/values.yaml