From 99002f92f42d8bda64911ce083f90020bea8c697 Mon Sep 17 00:00:00 2001 From: Dylan Arbour Date: Mon, 15 Feb 2021 18:05:36 -0500 Subject: [PATCH] Update pkg/runtime to v0.8.2 pkg/runtime v0.8.2 introduces runtime/transform which includes `MergeMaps`: https://github.com/fluxcd/pkg/pull/85 Signed-off-by: Dylan Arbour --- cmd/flux/create_helmrelease.go | 3 ++- go.mod | 2 +- go.sum | 2 ++ internal/utils/utils.go | 21 --------------------- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/cmd/flux/create_helmrelease.go b/cmd/flux/create_helmrelease.go index 71b8c2f7..d316cfcf 100644 --- a/cmd/flux/create_helmrelease.go +++ b/cmd/flux/create_helmrelease.go @@ -25,6 +25,7 @@ import ( "github.com/fluxcd/flux2/internal/flags" "github.com/fluxcd/flux2/internal/utils" "github.com/fluxcd/pkg/apis/meta" + "github.com/fluxcd/pkg/runtime/transform" "github.com/spf13/cobra" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -198,7 +199,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { if valuesMap == nil { valuesMap = jsonMap } else { - valuesMap = utils.MergeMaps(valuesMap, jsonMap) + valuesMap = transform.MergeMaps(valuesMap, jsonMap) } } diff --git a/go.mod b/go.mod index 7f4b6bb4..7fcf1d21 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/fluxcd/notification-controller/api v0.8.0 github.com/fluxcd/pkg/apis/meta v0.8.0 github.com/fluxcd/pkg/git v0.3.0 - github.com/fluxcd/pkg/runtime v0.8.0 + github.com/fluxcd/pkg/runtime v0.8.2 github.com/fluxcd/pkg/ssh v0.0.5 github.com/fluxcd/pkg/untar v0.0.5 github.com/fluxcd/pkg/version v0.0.1 diff --git a/go.sum b/go.sum index 9c3c39b6..5f5b95de 100644 --- a/go.sum +++ b/go.sum @@ -215,6 +215,8 @@ github.com/fluxcd/pkg/git v0.3.0/go.mod h1:ZwG0iLOqNSyNw6lsPIAO+v6+BqqCXyV+r1Oq6 github.com/fluxcd/pkg/runtime v0.6.2/go.mod h1:RuqYOYCvBJwo4rg83d28WOt2vfSaemuZCVpUagAjWQc= github.com/fluxcd/pkg/runtime v0.8.0 h1:cnSBZJLcXlKgjXpFFFExu+4ZncIxmPgNIx+ErLcCLnA= github.com/fluxcd/pkg/runtime v0.8.0/go.mod h1:tQwEN+RESjJmtwSSv7I+6bkNM9raIXpGsCjruaIVX6A= +github.com/fluxcd/pkg/runtime v0.8.2 h1:NeQPw9srRH4zmu2eM+NJ9QdJMd0RcyOr4j5WiWQU8as= +github.com/fluxcd/pkg/runtime v0.8.2/go.mod h1:tQwEN+RESjJmtwSSv7I+6bkNM9raIXpGsCjruaIVX6A= github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A= github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs= github.com/fluxcd/pkg/untar v0.0.5 h1:UGI3Ch1UIEIaqQvMicmImL1s9npQa64DJ/ozqHKB7gk= diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 94b26866..cdfdff35 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -367,27 +367,6 @@ func ValidateComponents(components []string) error { return nil } -// TODO(stefan): move this to fluxcd/pkg -// taken from: https://github.com/fluxcd/helm-controller/blob/main/internal/util/util.go -func MergeMaps(a, b map[string]interface{}) map[string]interface{} { - out := make(map[string]interface{}, len(a)) - for k, v := range a { - out[k] = v - } - for k, v := range b { - if v, ok := v.(map[string]interface{}); ok { - if bv, ok := out[k]; ok { - if bv, ok := bv.(map[string]interface{}); ok { - out[k] = MergeMaps(bv, v) - continue - } - } - } - out[k] = v - } - return out -} - // CompatibleVersion returns if the provided binary version is compatible // with the given target version. At present, this is true if the target // version is equal to the MINOR range of the binary, or if the binary