diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 3f5895c4d..26ea5cf5b 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -351,7 +351,7 @@ func processImportValues(c *chart.Chart, v *chart.Config) error { } case string: nm := make(map[string]string) - nm["child"] = riv.(string) + nm["child"] = "exports." + riv.(string) nm["parent"] = "." outiv = append(outiv, nm) s := r.Name + "." + nm["child"] diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index 21268df9d..59c4ecc11 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -226,6 +226,12 @@ func TestProcessRequirementsImportValues(t *testing.T) { e["imported-from-chartA-via-chart1.limits.memory"] = "300Mi" e["imported-from-chartA-via-chart1.limits.volume"] = "11" e["imported-from-chartA-via-chart1.requests.truthiness"] = "0.01" + // single list items (looks for exports. parent key) + e["imported-from-chartB-via-chart1.databint"] = "1" + e["imported-from-chartB-via-chart1.databstr"] = "x.y.z" + e["parent1c3"] = "true" + // checks that a chartb value was merged in with charta values + e["imported-from-chartA-via-chart1.resources.limits.shares"] = "100" verifyRequirementsImportValues(t, c, v, e) } @@ -254,6 +260,12 @@ func verifyRequirementsImportValues(t *testing.T, c *chart.Chart, v *chart.Confi t.Errorf("Failed to match imported float value %v with expected %v", s, vv) return } + case bool: + b := strconv.FormatBool(pv.(bool)) + if b != vv { + t.Errorf("Failed to match imported bool value %v with expected %v", b, vv) + return + } default: if pv.(string) != vv { t.Errorf("Failed to match imported string value %v with expected %v", pv, vv) diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/charts/subchartB/values.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/charts/subchartB/values.yaml index 5e5b21065..5f473ef61 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/charts/subchartB/values.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/charts/subchartB/values.yaml @@ -18,4 +18,12 @@ resources: requests: cpu: 100m memory: 128Mi - +exports: + convention1: + data: + databint: 1 + databstr: x.y.z + convention2: + resources: + limits: + shares: 100 diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/requirements.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/requirements.yaml index 5adf2f10a..cb62b9f36 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/requirements.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/requirements.yaml @@ -16,6 +16,9 @@ dependencies: repository: http://localhost:10191 version: 0.1.0 condition: subchartb.enabled + import-values: + - convention1 + - convention2 tags: - front-end - subchartb diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/values.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/values.yaml index 4c5085d82..15ba88485 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/values.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/values.yaml @@ -21,4 +21,7 @@ resources: cpu: 250m memory: 250Mi truthiness: 200 +exports: + convention3: + parent1c3: true diff --git a/pkg/chartutil/testdata/subpop/requirements.yaml b/pkg/chartutil/testdata/subpop/requirements.yaml index 19d320889..e299d057b 100644 --- a/pkg/chartutil/testdata/subpop/requirements.yaml +++ b/pkg/chartutil/testdata/subpop/requirements.yaml @@ -11,6 +11,12 @@ dependencies: parent: imported-from-chart1 - child: imported-from-chartA parent: imported-from-chartA-via-chart1 + - convention3 + # this merges chartb "shares" into charta "limits" + - child: resources.limits + parent: imported-from-chartA-via-chart1.resources.limits + - child: data + parent: imported-from-chartB-via-chart1 - name: subchart2 repository: http://localhost:10191 version: 0.1.0