diff --git a/charts/deployment-operator/Chart.yaml b/charts/deployment-operator/Chart.yaml index 7f771124..f923bb98 100644 --- a/charts/deployment-operator/Chart.yaml +++ b/charts/deployment-operator/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: deployment-operator description: creates a new instance of the plural deployment operator type: application -version: 0.4.5 +version: 0.4.6 appVersion: "0.4.5" maintainers: - name: Plural diff --git a/charts/deployment-operator/templates/deployment.yaml b/charts/deployment-operator/templates/deployment.yaml index 8e2b8740..88759787 100644 --- a/charts/deployment-operator/templates/deployment.yaml +++ b/charts/deployment-operator/templates/deployment.yaml @@ -18,6 +18,9 @@ spec: {{- end }} labels: {{- include "deployment-operator.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/deployment-operator/values.yaml b/charts/deployment-operator/values.yaml index 03bccffa..3eda9a8c 100644 --- a/charts/deployment-operator/values.yaml +++ b/charts/deployment-operator/values.yaml @@ -36,6 +36,7 @@ serviceAccount: rbac: clusterRole: cluster-admin +podLabels: {} podAnnotations: {} # prometheus.io/scrape: "true" # prometheus.io/path: "/metrics" diff --git a/go.mod b/go.mod index 1bfdc511..79567307 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/pluralsh/deployment-operator go 1.21 require ( + dario.cat/mergo v1.0.0 github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/sprig/v3 v3.2.3 github.com/Yamashou/gqlgenc v0.14.0 diff --git a/go.sum b/go.sum index fa4c7d27..30c10fc5 100644 --- a/go.sum +++ b/go.sum @@ -39,6 +39,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= diff --git a/pkg/manifests/template/helm.go b/pkg/manifests/template/helm.go index 0bde5a6a..478f80ee 100644 --- a/pkg/manifests/template/helm.go +++ b/pkg/manifests/template/helm.go @@ -157,7 +157,7 @@ func (h *helm) values(svc *console.ServiceDeploymentExtended) (map[string]interf if err != nil { return currentMap, err } - currentMap = lo.Assign(currentMap, nextMap) + currentMap = merge(currentMap, nextMap) } } @@ -166,7 +166,28 @@ func (h *helm) values(svc *console.ServiceDeploymentExtended) (map[string]interf return currentMap, nil } - return lo.Assign(currentMap, overrides), nil + return merge(currentMap, overrides), nil +} + +func merge(m1, m2 map[string]interface{}) map[string]interface{} { + // lifted from helm's merge code + out := make(map[string]interface{}, len(m1)) + for k, v := range m1 { + out[k] = v + } + + for k, v := range m2 { + if v, ok := v.(map[string]interface{}); ok { + if bv, ok := out[k]; ok { + if bv, ok := bv.(map[string]interface{}); ok { + out[k] = merge(bv, v) + continue + } + } + } + out[k] = v + } + return out } func (h *helm) valuesFile(svc *console.ServiceDeploymentExtended, filename string) (map[string]interface{}, error) {