Skip to content

Commit

Permalink
Fix chart-upgrade as a result of yaml library upgrade
Browse files Browse the repository at this point in the history
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) <[email protected]>
  • Loading branch information
alexellis committed Oct 2, 2023
1 parent b3aa513 commit 9c9b29c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/helm/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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)
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9c9b29c

Please sign in to comment.