From 67c5129e5167018963d5c0e8fb71e411da388743 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Thu, 6 Jul 2017 19:48:42 -0400 Subject: [PATCH] Change switch to regex --- pkg/chartutil/values.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 75fc6d3b1..8869c72b0 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -21,6 +21,7 @@ import ( "io" "io/ioutil" "log" + "regexp" "strings" "github.com/ghodss/yaml" @@ -282,10 +283,12 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf // This allows Helm's various sources of values (value files or --set) to // remove incompatible keys from any previous chart, file, or set values. // ref: http://www.yaml.org/spec/1.2/spec.html#id2803362 - switch val { - case "null", "Null", "NULL", "~": - delete(v, key) - continue + var nullPattern = regexp.MustCompile("^(?:null|Null|NULL|~)$") + if str, ok := val.(string); ok { + if nullPattern.MatchString(str) { + delete(v, key) + continue + } } if _, ok := v[key]; !ok {