From 9c9b29c1e97c4a893a652e2c594a84e8001e6885 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Mon, 2 Oct 2023 14:02:23 +0100 Subject: [PATCH] Fix chart-upgrade as a result of yaml library upgrade The v3 version of the YAML package used in arkade no longer parses YAML maps as interface/interface, but string/interface so introduced regression into the chart upgrade/verify commands. This commit switches to string/interface{} and fixes the issue. Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- pkg/helm/io.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/helm/io.go b/pkg/helm/io.go index 12d958be2..f6debdd85 100644 --- a/pkg/helm/io.go +++ b/pkg/helm/io.go @@ -10,7 +10,7 @@ import ( ) // ValuesMap is an alias for map[string]interface{} -type ValuesMap map[interface{}]interface{} +type ValuesMap map[string]interface{} // Load a values.yaml file and return a ValuesMap with the keys // and values from the YAML file as a map[string]interface{} @@ -22,8 +22,7 @@ func Load(yamlPath string) (ValuesMap, error) { values := ValuesMap{} - err = yaml.Unmarshal(body, &values) - if err != nil { + if err = yaml.Unmarshal(body, &values); err != nil { return nil, fmt.Errorf("unable to parse %s, error: %s", yamlPath, err) } @@ -51,6 +50,7 @@ func FilterImagesUptoDepth(values ValuesMap, depth int) map[string]string { images := map[string]string{} for k, v := range values { + if k == "image" && reflect.TypeOf(v).Kind() == reflect.String { imageUrl := v.(string) images[imageUrl] = imageUrl