fix: fix while using local charts with version

fix https://github.com/kubernetes-sigs/kustomize/issues/5163

Signed-off-by: Ardika Bagus <me@ardikabs.com>
This commit is contained in:
Ardika Bagus
2023-08-24 22:18:16 +07:00
parent a0f131cf86
commit cc35d3c4e5
3 changed files with 65 additions and 15 deletions

View File

@@ -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