Commit fbe80437 authored by Justin Scott's avatar Justin Scott

fix(helm): fix importValues warnings from disabled charts

ImportValues incorrectly processes charts that should be disabled. This
patch excludes those charts.

Closes #2620
parent e1027fae
...@@ -394,6 +394,21 @@ func processImportValues(c *chart.Chart) error { ...@@ -394,6 +394,21 @@ func processImportValues(c *chart.Chart) error {
b := make(map[string]interface{}, 0) b := make(map[string]interface{}, 0)
// import values from each dependency if specified in import-values // import values from each dependency if specified in import-values
for _, r := range reqs.Dependencies { for _, r := range reqs.Dependencies {
// only process raw requirement that is found in chart's dependencies (enabled)
found := false
name := r.Name
for _, v := range c.Dependencies {
if v.Metadata.Name == r.Name {
found = true
}
if v.Metadata.Name == r.Alias {
found = true
name = r.Alias
}
}
if !found {
continue
}
if len(r.ImportValues) > 0 { if len(r.ImportValues) > 0 {
var outiv []interface{} var outiv []interface{}
for _, riv := range r.ImportValues { for _, riv := range r.ImportValues {
...@@ -404,7 +419,7 @@ func processImportValues(c *chart.Chart) error { ...@@ -404,7 +419,7 @@ func processImportValues(c *chart.Chart) error {
"parent": iv["parent"].(string), "parent": iv["parent"].(string),
} }
outiv = append(outiv, nm) outiv = append(outiv, nm)
s := r.Name + "." + nm["child"] s := name + "." + nm["child"]
// get child table // get child table
vv, err := cvals.Table(s) vv, err := cvals.Table(s)
if err != nil { if err != nil {
...@@ -420,7 +435,7 @@ func processImportValues(c *chart.Chart) error { ...@@ -420,7 +435,7 @@ func processImportValues(c *chart.Chart) error {
"parent": ".", "parent": ".",
} }
outiv = append(outiv, nm) outiv = append(outiv, nm)
s := r.Name + "." + nm["child"] s := name + "." + nm["child"]
vm, err := cvals.Table(s) vm, err := cvals.Table(s)
if err != nil { if err != nil {
log.Printf("Warning: ImportValues missing table: %v", err) log.Printf("Warning: ImportValues missing table: %v", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment