From b4d6eaaaab3bbf73babddc68d9cc25af3c69d3cf Mon Sep 17 00:00:00 2001 From: Michael Mair Date: Thu, 17 Jun 2021 14:51:46 +0200 Subject: [PATCH] import all values from a dependency chart Signed-off-by: Michael Mair --- pkg/chartutil/dependencies.go | 6 +++++- pkg/chartutil/dependencies_test.go | 11 +++++++++++ pkg/chartutil/testdata/subpop/Chart.yaml | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/chartutil/dependencies.go b/pkg/chartutil/dependencies.go index d2e7d6dc9..d7adbb912 100644 --- a/pkg/chartutil/dependencies.go +++ b/pkg/chartutil/dependencies.go @@ -242,7 +242,11 @@ func processImportValues(c *chart.Chart) error { }) // get child table - vv, err := cvals.Table(r.Name + "." + child) + ref := r.Name + "." + child + if child == "." { + ref = r.Name + } + vv, err := cvals.Table(ref) if err != nil { log.Printf("Warning: ImportValues missing table from chart %s: %v", r.Name, err) continue diff --git a/pkg/chartutil/dependencies_test.go b/pkg/chartutil/dependencies_test.go index bcb1d40e5..9778c0fb0 100644 --- a/pkg/chartutil/dependencies_test.go +++ b/pkg/chartutil/dependencies_test.go @@ -206,6 +206,17 @@ func TestProcessDependencyImportValues(t *testing.T) { e["overridden-chartA-B.SCBextra1"] = "13" e["overridden-chartA-B.SC1extra6"] = "77" + e["all.service.name"] = "nginx" + e["all.service.type"] = "ClusterIP" + e["all.service.externalPort"] = "80" + e["all.service.internalPort"] = "80" + e["all.SC1data.SC1bool"] = "true" + e["all.imported-chartA.SC1extra2"] = "1.337" + e["all.overridden-chartA.SCAbool"] = "true" + e["all.imported-chartA-B.SC1extra5"] = "tiller" + e["all.overridden-chartA-B.SCAbool"] = "true" + e["all.SCBexported1A.SC1extra7"] = "true" + // `exports` style e["SCBexported1B"] = "1965" e["SC1extra7"] = "true" diff --git a/pkg/chartutil/testdata/subpop/Chart.yaml b/pkg/chartutil/testdata/subpop/Chart.yaml index 27118672a..7459e0575 100644 --- a/pkg/chartutil/testdata/subpop/Chart.yaml +++ b/pkg/chartutil/testdata/subpop/Chart.yaml @@ -25,6 +25,8 @@ dependencies: parent: . - SCBexported2 - SC1exported1 + - child: . + parent: all - name: subchart2 repository: http://localhost:10191