Merge pull request #923 from arbourd/update-runtime
Use `MergeMaps` from pkg/runtime v0.8.2
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
"github.com/fluxcd/pkg/runtime/transform"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||||
@@ -198,7 +199,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
if valuesMap == nil {
|
if valuesMap == nil {
|
||||||
valuesMap = jsonMap
|
valuesMap = jsonMap
|
||||||
} else {
|
} else {
|
||||||
valuesMap = utils.MergeMaps(valuesMap, jsonMap)
|
valuesMap = transform.MergeMaps(valuesMap, jsonMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -12,7 +12,7 @@ require (
|
|||||||
github.com/fluxcd/notification-controller/api v0.8.0
|
github.com/fluxcd/notification-controller/api v0.8.0
|
||||||
github.com/fluxcd/pkg/apis/meta v0.8.0
|
github.com/fluxcd/pkg/apis/meta v0.8.0
|
||||||
github.com/fluxcd/pkg/git v0.3.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/ssh v0.0.5
|
||||||
github.com/fluxcd/pkg/untar v0.0.5
|
github.com/fluxcd/pkg/untar v0.0.5
|
||||||
github.com/fluxcd/pkg/version v0.0.1
|
github.com/fluxcd/pkg/version v0.0.1
|
||||||
|
|||||||
2
go.sum
2
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.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 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.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 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A=
|
||||||
github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs=
|
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=
|
github.com/fluxcd/pkg/untar v0.0.5 h1:UGI3Ch1UIEIaqQvMicmImL1s9npQa64DJ/ozqHKB7gk=
|
||||||
|
|||||||
@@ -367,27 +367,6 @@ func ValidateComponents(components []string) error {
|
|||||||
return nil
|
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
|
// CompatibleVersion returns if the provided binary version is compatible
|
||||||
// with the given target version. At present, this is true if the target
|
// 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
|
// version is equal to the MINOR range of the binary, or if the binary
|
||||||
|
|||||||
Reference in New Issue
Block a user