Signed-off-by: Drew Gonzales <drew.gonzales@datadoghq.com>
pull/11760/head
Drew Gonzales 3 years ago
parent 33419b11f9
commit afb623031c
No known key found for this signature in database

@ -267,10 +267,7 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable)
} }
usedValues = usedValues.Union(traverse(t.Lookup(filename).Copy().Root)) usedValues = usedValues.Union(traverse(t.Lookup(filename).Copy().Root))
pv, err := getProvidedValues(vals) pv := getProvidedValues(vals)
if err != nil {
return map[string]string{}, err
}
providedValues = providedValues.Union(pv) providedValues = providedValues.Union(pv)
// Work around the issue where Go will emit "<no value>" even if Options(missing=zero) // Work around the issue where Go will emit "<no value>" even if Options(missing=zero)
@ -495,13 +492,15 @@ func traverse(cur parse.Node) sets.Set[string] {
return vars return vars
} }
func getProvidedValues(vals chartutil.Values) (sets.Set[string], error) { func getProvidedValues(vals chartutil.Values) sets.Set[string] {
v, ok := vals["Values"].(chartutil.Values) v, ok := vals["Values"].(chartutil.Values)
if !ok { if !ok {
return nil, fmt.Errorf("luh") // When checking for unused values, if no values are found, we
// swallow the error here.
return sets.New[string]()
} }
f := flattenMapKeys(".Values", v) f := flattenMapKeys(".Values", v)
return sets.New(f...), nil return sets.New(f...)
} }
// flattenMapKeys turns an interface into a list of variable paths to make it easy to log and // flattenMapKeys turns an interface into a list of variable paths to make it easy to log and

Loading…
Cancel
Save