You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Helm should be able to deep merge multiple values files. This is helpful when you want to pass different variables for different environments (like whether or not to use a PVC) As it stands right now, it just overwrites the previous variable.
Example
Given these two values files for an example postgresql subchart
secrets.yaml
postgresql:
postgresPassword: "super-secret-pass"
dev_environment.yaml
postgresql:
persistence:
enabled: false
Current Behavior
When using -f secrets.yaml -f dev_environment.yaml with helm install, the variables available would look like this:
postgresql:
persistence:
enabled: false
If we swap the flags: -f dev_environment.yaml -f secrets.yaml, the variables look like:
postgresql:
postgresPassword: "super-secret-pass"
Desired Behavior
When using -f secrets.yaml -f dev_environment.yaml with helm install, the variables available would look like this:
Is there another way to get this behavior or would this need to be added?
Reacted by Sebastian Mandrean, Hunter Satterwhite, Nikolai Zujev, Marcin Kłopotek, Shane Ramey, Andrew Stangl, Kevin Pullin, Haoyu Wang, Dominic Bauer, Fleur Kelpin and 11 more
Side note: I know that this would make the ordering of the files passed with the -f flag important, because if there are variables with the same name, one would overwrite the others.
I am not sure Cobra will allow us to repeat flags. But if we can figure out a way around that, I think we could just pass files through the existing -f/--set merge logic.
We might be able to change -f to accept a []string, which (IIRC) is expressed on CLI as -f foo.yaml,bar.yaml.
@technosophos: Thanks for the quick response. It looks like it does (from the godoc example):
// Set is the method to set the flag value, part of the flag.Value interface.
// Set's argument is a string to be parsed to set the flag.
// It's a comma-separated list, so we split it.
func (i *interval) Set(value string) error {
// If we wanted to allow the flag to be set multiple times,
// accumulating values, we would delete this if statement.
// That would permit usages such as
// -deltaT 10s -deltaT 15s
// and other combinations.
if len(*i) > 0 {
return errors.New("interval flag already set")
}
for _, dt := range strings.Split(value, ",") {
duration, err := time.ParseDuration(dt)
if err != nil {
return err
}
*i = append(*i, duration)
}
return nil
}
Activity
thomastaylor312 commentedon Dec 1, 2016
Side note: I know that this would make the ordering of the files passed with the
-fflag important, because if there are variables with the same name, one would overwrite the others.technosophos commentedon Dec 1, 2016
I am not sure Cobra will allow us to repeat flags. But if we can figure out a way around that, I think we could just pass files through the existing
-f/--setmerge logic.We might be able to change
-fto accept a[]string, which (IIRC) is expressed on CLI as-f foo.yaml,bar.yaml.thomastaylor312 commentedon Dec 2, 2016
@technosophos: Thanks for the quick response. It looks like it does (from the godoc example):
fix(helm): add support for multiple values files
fix(helm): add support for multiple values files
feat(helm): add support for multiple values files
feat(helm): add support for multiple values files
feat(helm): add support for multiple values files
Fix deep merge of ValuesYamlFiles (#2963)