From 95c47763499e53ce5167edd72905436cea249e8f Mon Sep 17 00:00:00 2001 From: S Code Man <30977678+scodeman@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:18:16 +0000 Subject: [PATCH] fix: add child/parent support to import-values --- requirements.go | 4 +++- testdata/charts/importvalues/Chart.yaml | 2 ++ .../charts/importvalues/charts/mydep-1.0.0.tgz | Bin 287 -> 297 bytes testdata/charts/importvalues/mydep/values.yaml | 2 ++ .../importvalues/templates/configmap.yaml | 1 + .../local_chart_with_import_values/want | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/requirements.go b/requirements.go index 26cb1a1..eaa3d2e 100644 --- a/requirements.go +++ b/requirements.go @@ -18,7 +18,9 @@ type Dependency struct { Condition string `yaml:"condition,omitempty"` Alias string `yaml:"alias,omitempty"` Version string `yaml:"version,omitempty"` - ImportValues []string `yaml:"import-values,omitempty"` + // ImportValues holds the mapping of source values to parent key to be imported. Each item can be a + // string or pair of child/parent sublist items. + ImportValues []interface{} `json:"import-values,omitempty"` } type ChartDependency struct { diff --git a/testdata/charts/importvalues/Chart.yaml b/testdata/charts/importvalues/Chart.yaml index e9159fe..1f0c920 100644 --- a/testdata/charts/importvalues/Chart.yaml +++ b/testdata/charts/importvalues/Chart.yaml @@ -9,3 +9,5 @@ dependencies: version: 1.0.0 import-values: - data + - child: myval2 + parent: myval2 diff --git a/testdata/charts/importvalues/charts/mydep-1.0.0.tgz b/testdata/charts/importvalues/charts/mydep-1.0.0.tgz index d556552835a6b98d47e8276be4d9bcba38722713..e95761e383247a2367fba2159c241e41fcc1acf9 100644 GIT binary patch delta 245 zcmV zMLb9qm;5f%9`Z3T|G2qje|7UhAr&(@D|Ud0c&O{OBI359sW^009607TsSt01N;Cm>YZ8 delta 235 zcmV0Emd!#_Sal%ZkdhLK$;zPs*IN7O3<|qX0bO zF{L?WiUPlVSJ~VjL1B30n1*SzuxQzH>f#XczP^Ebb{@KIIAq{?itsQ$aU3~wk|TMx zuuqT7YhVi$f*U&8w#wz>NY!A2^0%9;KJ}jeh1|^Ps1M+){G-7#|7~0I|0DP{Ofe@b l0eZ@`RRF&(E;YJURaO7gTL1t6|NjLp-)jI2000Ybb1eV> diff --git a/testdata/charts/importvalues/mydep/values.yaml b/testdata/charts/importvalues/mydep/values.yaml index 5020230..0057584 100644 --- a/testdata/charts/importvalues/mydep/values.yaml +++ b/testdata/charts/importvalues/mydep/values.yaml @@ -1,3 +1,5 @@ exports: data: myval: FOO + +myval2: BAR diff --git a/testdata/charts/importvalues/templates/configmap.yaml b/testdata/charts/importvalues/templates/configmap.yaml index 7a53a82..a613ce6 100644 --- a/testdata/charts/importvalues/templates/configmap.yaml +++ b/testdata/charts/importvalues/templates/configmap.yaml @@ -5,3 +5,4 @@ metadata: namespace: {{ .Release.Namespace }} data: foo: {{ .Values.myval }} + bar: {{ .Values.myval2 }} diff --git a/testdata/integration/testcases/local_chart_with_import_values/want b/testdata/integration/testcases/local_chart_with_import_values/want index cb8724d..fe5ff6b 100644 --- a/testdata/integration/testcases/local_chart_with_import_values/want +++ b/testdata/integration/testcases/local_chart_with_import_values/want @@ -7,3 +7,4 @@ metadata: namespace: default data: foo: FOO + bar: BAR