diff --git a/helmcli/release.go b/helmcli/release.go index b0e4d57..736fbac 100644 --- a/helmcli/release.go +++ b/helmcli/release.go @@ -47,6 +47,7 @@ func YAMLValuesApplier(yamlValues string) (ValuesApplier, error) { if err != nil { return nil, err } +<<<<<<< HEAD return func(to map[string]interface{}) error { return applyValues(to, values) @@ -77,6 +78,41 @@ func applyValues(to, from map[string]interface{}) error { return nil } +======= + return func(to map[string]interface{}) error { + for k, v := range values { + // If 'to' doesn't have key 'k' + if _, checkKey := to[k]; !checkKey { + to[k] = v + } else { + // If 'to' has key 'k' + switch v := v.(type) { + case map[string]interface{}: + // If 'v' is of type map[string]interface{} + if toMap, checkKey := to[k].(map[string]interface{}); checkKey { + // Recursively apply the values + applier, err := YAMLValuesApplier("") + if err != nil { + return err + } + err = applier(toMap) + if err != nil { + return err + } + } else { + to[k] = v + } + default: + // If 'v' is not of type map[string]interface{} + to[k] = v + } + } + } + return nil + }, nil +} + +>>>>>>> bb68bf0f8a9bfaaf804bf0a6fab5d6b90976f1b4 // ReleaseCli is a client to deploy helm chart with secret storage. type ReleaseCli struct { namespace string