mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-01 18:08:13 +02:00
PR #2367 introduced CLIOverrides to give --state-values-set element-by-element array merge semantics. However, nested helmfile values (helmfiles[].values:) were also routed into CLIOverrides, causing their arrays to merge instead of replace. This broke the pre-v1.3.0 behavior where passing an array via helmfiles[].values: would fully replace the child's default array. Add OverrideValuesAreCLI flag to SubhelmfileEnvironmentSpec so the loader can distinguish CLI flags from nested helmfile values. CLI values continue using CLIOverrides (element-by-element merge); nested helmfile values now use Values (Sparse merge strategy → full array replacement). Fixes #2451 Signed-off-by: Aditya Menon <amenon@canarytechnologies.com>
37 lines
621 B
Go
37 lines
621 B
Go
package app
|
|
|
|
import (
|
|
"github.com/helmfile/helmfile/pkg/state"
|
|
"github.com/helmfile/helmfile/pkg/yaml"
|
|
)
|
|
|
|
type LoadOpts struct {
|
|
Selectors []string
|
|
Environment state.SubhelmfileEnvironmentSpec
|
|
|
|
RetainValuesFiles bool
|
|
|
|
// CalleePath is the absolute path to the file being loaded
|
|
CalleePath string
|
|
|
|
Reverse bool
|
|
|
|
Filter bool
|
|
}
|
|
|
|
func (o LoadOpts) DeepCopy() LoadOpts {
|
|
bytes, err := yaml.Marshal(o)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
new := LoadOpts{}
|
|
if err := yaml.Unmarshal(bytes, &new); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
new.Environment.OverrideValuesAreCLI = o.Environment.OverrideValuesAreCLI
|
|
|
|
return new
|
|
}
|