mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 10:15:22 +00:00
Localize helm additionValuesFiles (#5013)
This commit is contained in:
@@ -52,6 +52,10 @@ func (lbp *localizeBuiltinPlugins) Filter(plugins []*yaml.RNode) ([]*yaml.RNode,
|
||||
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.HelmChartInflationGenerator.String()},
|
||||
Path: "valuesFile",
|
||||
},
|
||||
types.FieldSpec{
|
||||
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.HelmChartInflationGenerator.String()},
|
||||
Path: "additionalValuesFiles",
|
||||
},
|
||||
types.FieldSpec{
|
||||
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.PatchTransformer.String()},
|
||||
Path: "path",
|
||||
|
||||
@@ -280,6 +280,14 @@ func (lc *localizer) localizeHelmCharts(kust *types.Kustomization) error {
|
||||
return errors.WrapPrefixf(err, "unable to localize helmCharts entry %d valuesFile", i)
|
||||
}
|
||||
kust.HelmCharts[i].ValuesFile = locFile
|
||||
|
||||
for j, valuesFile := range chart.AdditionalValuesFiles {
|
||||
locFile, err = lc.localizeFile(valuesFile)
|
||||
if err != nil {
|
||||
return errors.WrapPrefixf(err, "unable to localize helmCharts entry %d additionalValuesFiles", i)
|
||||
}
|
||||
kust.HelmCharts[i].AdditionalValuesFiles[j] = locFile
|
||||
}
|
||||
}
|
||||
if kust.HelmGlobals != nil {
|
||||
locDir, err := lc.copyChartHomeEntry(kust.HelmGlobals.ChartHome)
|
||||
|
||||
@@ -1273,8 +1273,13 @@ func TestLocalizeHelmCharts(t *testing.T) {
|
||||
- includeCRDs: true
|
||||
name: localize-valuesFile
|
||||
valuesFile: file
|
||||
- additionalValuesFiles:
|
||||
- another
|
||||
- third
|
||||
`,
|
||||
"file": valuesFile,
|
||||
"another": valuesFile,
|
||||
"third": valuesFile,
|
||||
"charts/nothing-to-localize/values.yaml": valuesFile,
|
||||
"charts/localize-valuesFile/values.yaml": valuesFile,
|
||||
},
|
||||
@@ -1513,7 +1518,11 @@ releaseName: moria
|
||||
repo: https://itzg.github.io/minecraft-server-charts
|
||||
version: 3.1.3
|
||||
`,
|
||||
"explicit.yaml": `apiVersion: builtin
|
||||
"explicit.yaml": `additionalValuesFiles:
|
||||
- time.yaml
|
||||
- life.yaml
|
||||
- light.yaml
|
||||
apiVersion: builtin
|
||||
chartHome: home
|
||||
kind: HelmChartInflationGenerator
|
||||
metadata:
|
||||
@@ -1521,6 +1530,9 @@ metadata:
|
||||
name: mapleStory
|
||||
valuesFile: mapleValues.yaml
|
||||
`,
|
||||
"time.yaml": valuesFile,
|
||||
"life.yaml": valuesFile,
|
||||
"light.yaml": valuesFile,
|
||||
"mapleValues.yaml": valuesFile,
|
||||
"home/mapleStory/values.yaml": valuesFile,
|
||||
"charts/minecraft/values.yaml": valuesFile,
|
||||
|
||||
Reference in New Issue
Block a user