diff --git a/.changes/unreleased/chart-connectors-Fixed-20250109-154417.yaml b/.changes/unreleased/chart-connectors-Fixed-20250109-154417.yaml new file mode 100644 index 000000000..bf7f2d9e0 --- /dev/null +++ b/.changes/unreleased/chart-connectors-Fixed-20250109-154417.yaml @@ -0,0 +1,4 @@ +project: chart-connectors +kind: Fixed +body: Connectors container command will not be set if the value is empty +time: 2025-01-09T15:44:17.717249+01:00 diff --git a/charts/connectors/CHANGELOG.md b/charts/connectors/CHANGELOG.md index b0502a707..d9dec3601 100644 --- a/charts/connectors/CHANGELOG.md +++ b/charts/connectors/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and is generated by [Changie](https://github.com/miniscruff/changie). +## Unreleased +### Fixed +* Connectors container command will not be set if the value is empty + ### [0.1.14](https://github.com/redpanda-data/helm-charts/releases/tag/connectors-0.1.14) - 2024-11-20 #### Added * Enabled flag that would be only used by Redpanda chart when partial values will be embedded into Redpanda values struct diff --git a/charts/connectors/deployment.go b/charts/connectors/deployment.go index 4f22c4567..2e9f52d61 100644 --- a/charts/connectors/deployment.go +++ b/charts/connectors/deployment.go @@ -87,7 +87,7 @@ func Deployment(dot *helmette.Dot) *appsv1.Deployment { } } - return &appsv1.Deployment{ + d := &appsv1.Deployment{ TypeMeta: metav1.TypeMeta{ APIVersion: "apps/v1", Kind: "Deployment", @@ -128,7 +128,6 @@ func Deployment(dot *helmette.Dot) *appsv1.Deployment { Image: fmt.Sprintf("%s:%s", values.Image.Repository, Tag(dot)), ImagePullPolicy: values.Image.PullPolicy, SecurityContext: &values.Container.SecurityContext, - Command: values.Deployment.Command, Env: env(&values), EnvFrom: values.Deployment.ExtraEnvFrom, LivenessProbe: &corev1.Probe{ @@ -182,6 +181,12 @@ func Deployment(dot *helmette.Dot) *appsv1.Deployment { }, }, } + + if !helmette.Empty(values.Deployment.Command) { + d.Spec.Template.Spec.Containers[0].Command = values.Deployment.Command + } + + return d } func env(values *Values) []corev1.EnvVar { diff --git a/charts/connectors/templates/_deployment.go.tpl b/charts/connectors/templates/_deployment.go.tpl index 9db8224ef..1a972918a 100644 --- a/charts/connectors/templates/_deployment.go.tpl +++ b/charts/connectors/templates/_deployment.go.tpl @@ -36,8 +36,12 @@ {{- end -}} {{- end -}} {{- end -}} +{{- $d := (mustMergeOverwrite (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "selector" (coalesce nil) "template" (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) "strategy" (dict ) ) "status" (dict ) ) (mustMergeOverwrite (dict ) (dict "apiVersion" "apps/v1" "kind" "Deployment" )) (dict "metadata" (mustMergeOverwrite (dict "creationTimestamp" (coalesce nil) ) (dict "name" (get (fromJson (include "connectors.Fullname" (dict "a" (list $dot) ))) "r") "labels" (merge (dict ) (get (fromJson (include "connectors.FullLabels" (dict "a" (list $dot) ))) "r") $values.deployment.annotations) )) "spec" (mustMergeOverwrite (dict "selector" (coalesce nil) "template" (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) "strategy" (dict ) ) (dict "replicas" $values.deployment.replicas "progressDeadlineSeconds" ($values.deployment.progressDeadlineSeconds | int) "revisionHistoryLimit" $values.deployment.revisionHistoryLimit "selector" (mustMergeOverwrite (dict ) (dict "matchLabels" (get (fromJson (include "connectors.PodLabels" (dict "a" (list $dot) ))) "r") )) "strategy" $values.deployment.strategy "template" (mustMergeOverwrite (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) (dict "metadata" (mustMergeOverwrite (dict "creationTimestamp" (coalesce nil) ) (dict "annotations" $values.deployment.annotations "labels" (get (fromJson (include "connectors.PodLabels" (dict "a" (list $dot) ))) "r") )) "spec" (mustMergeOverwrite (dict "containers" (coalesce nil) ) (dict "automountServiceAccountToken" false "terminationGracePeriodSeconds" $values.deployment.terminationGracePeriodSeconds "affinity" (mustMergeOverwrite (dict ) (dict "nodeAffinity" $values.deployment.nodeAffinity "podAffinity" $values.deployment.podAffinity "podAntiAffinity" $podAntiAffinity )) "serviceAccountName" (get (fromJson (include "connectors.ServiceAccountName" (dict "a" (list $dot) ))) "r") "containers" (list (mustMergeOverwrite (dict "name" "" "resources" (dict ) ) (dict "name" "connectors-cluster" "image" (printf "%s:%s" $values.image.repository (get (fromJson (include "connectors.Tag" (dict "a" (list $dot) ))) "r")) "imagePullPolicy" $values.image.pullPolicy "securityContext" $values.container.securityContext "env" (get (fromJson (include "connectors.env" (dict "a" (list $values) ))) "r") "envFrom" $values.deployment.extraEnvFrom "livenessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "httpGet" (mustMergeOverwrite (dict "port" 0 ) (dict "path" "/" "port" "rest-api" "scheme" "HTTP" )) )) (dict "initialDelaySeconds" ($values.deployment.livenessProbe.initialDelaySeconds | int) "timeoutSeconds" ($values.deployment.livenessProbe.timeoutSeconds | int) "periodSeconds" ($values.deployment.livenessProbe.periodSeconds | int) "successThreshold" ($values.deployment.livenessProbe.successThreshold | int) "failureThreshold" ($values.deployment.livenessProbe.failureThreshold | int) )) "readinessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "httpGet" (mustMergeOverwrite (dict "port" 0 ) (dict "path" "/connectors" "port" "rest-api" "scheme" "HTTP" )) )) (dict "initialDelaySeconds" ($values.deployment.readinessProbe.initialDelaySeconds | int) "timeoutSeconds" ($values.deployment.readinessProbe.timeoutSeconds | int) "periodSeconds" ($values.deployment.readinessProbe.periodSeconds | int) "successThreshold" ($values.deployment.readinessProbe.successThreshold | int) "failureThreshold" ($values.deployment.readinessProbe.failureThreshold | int) )) "ports" $ports "resources" (mustMergeOverwrite (dict ) (dict "requests" $values.container.resources.request "limits" $values.container.resources.limits )) "terminationMessagePath" "/dev/termination-log" "terminationMessagePolicy" "File" "volumeMounts" (get (fromJson (include "connectors.volumeMountss" (dict "a" (list $values) ))) "r") ))) "dnsPolicy" "ClusterFirst" "restartPolicy" $values.deployment.restartPolicy "schedulerName" $values.deployment.schedulerName "nodeSelector" $values.deployment.nodeSelector "imagePullSecrets" $values.imagePullSecrets "securityContext" $values.deployment.securityContext "tolerations" $values.deployment.tolerations "topologySpreadConstraints" $topologySpreadConstraints "volumes" (get (fromJson (include "connectors.volumes" (dict "a" (list $values) ))) "r") )) )) )) )) -}} +{{- if (not (empty $values.deployment.command)) -}} +{{- $_ := (set (index $d.spec.template.spec.containers (0 | int)) "command" $values.deployment.command) -}} +{{- end -}} {{- $_is_returning = true -}} -{{- (dict "r" (mustMergeOverwrite (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "selector" (coalesce nil) "template" (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) "strategy" (dict ) ) "status" (dict ) ) (mustMergeOverwrite (dict ) (dict "apiVersion" "apps/v1" "kind" "Deployment" )) (dict "metadata" (mustMergeOverwrite (dict "creationTimestamp" (coalesce nil) ) (dict "name" (get (fromJson (include "connectors.Fullname" (dict "a" (list $dot) ))) "r") "labels" (merge (dict ) (get (fromJson (include "connectors.FullLabels" (dict "a" (list $dot) ))) "r") $values.deployment.annotations) )) "spec" (mustMergeOverwrite (dict "selector" (coalesce nil) "template" (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) "strategy" (dict ) ) (dict "replicas" $values.deployment.replicas "progressDeadlineSeconds" ($values.deployment.progressDeadlineSeconds | int) "revisionHistoryLimit" $values.deployment.revisionHistoryLimit "selector" (mustMergeOverwrite (dict ) (dict "matchLabels" (get (fromJson (include "connectors.PodLabels" (dict "a" (list $dot) ))) "r") )) "strategy" $values.deployment.strategy "template" (mustMergeOverwrite (dict "metadata" (dict "creationTimestamp" (coalesce nil) ) "spec" (dict "containers" (coalesce nil) ) ) (dict "metadata" (mustMergeOverwrite (dict "creationTimestamp" (coalesce nil) ) (dict "annotations" $values.deployment.annotations "labels" (get (fromJson (include "connectors.PodLabels" (dict "a" (list $dot) ))) "r") )) "spec" (mustMergeOverwrite (dict "containers" (coalesce nil) ) (dict "automountServiceAccountToken" false "terminationGracePeriodSeconds" $values.deployment.terminationGracePeriodSeconds "affinity" (mustMergeOverwrite (dict ) (dict "nodeAffinity" $values.deployment.nodeAffinity "podAffinity" $values.deployment.podAffinity "podAntiAffinity" $podAntiAffinity )) "serviceAccountName" (get (fromJson (include "connectors.ServiceAccountName" (dict "a" (list $dot) ))) "r") "containers" (list (mustMergeOverwrite (dict "name" "" "resources" (dict ) ) (dict "name" "connectors-cluster" "image" (printf "%s:%s" $values.image.repository (get (fromJson (include "connectors.Tag" (dict "a" (list $dot) ))) "r")) "imagePullPolicy" $values.image.pullPolicy "securityContext" $values.container.securityContext "command" $values.deployment.command "env" (get (fromJson (include "connectors.env" (dict "a" (list $values) ))) "r") "envFrom" $values.deployment.extraEnvFrom "livenessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "httpGet" (mustMergeOverwrite (dict "port" 0 ) (dict "path" "/" "port" "rest-api" "scheme" "HTTP" )) )) (dict "initialDelaySeconds" ($values.deployment.livenessProbe.initialDelaySeconds | int) "timeoutSeconds" ($values.deployment.livenessProbe.timeoutSeconds | int) "periodSeconds" ($values.deployment.livenessProbe.periodSeconds | int) "successThreshold" ($values.deployment.livenessProbe.successThreshold | int) "failureThreshold" ($values.deployment.livenessProbe.failureThreshold | int) )) "readinessProbe" (mustMergeOverwrite (dict ) (mustMergeOverwrite (dict ) (dict "httpGet" (mustMergeOverwrite (dict "port" 0 ) (dict "path" "/connectors" "port" "rest-api" "scheme" "HTTP" )) )) (dict "initialDelaySeconds" ($values.deployment.readinessProbe.initialDelaySeconds | int) "timeoutSeconds" ($values.deployment.readinessProbe.timeoutSeconds | int) "periodSeconds" ($values.deployment.readinessProbe.periodSeconds | int) "successThreshold" ($values.deployment.readinessProbe.successThreshold | int) "failureThreshold" ($values.deployment.readinessProbe.failureThreshold | int) )) "ports" $ports "resources" (mustMergeOverwrite (dict ) (dict "requests" $values.container.resources.request "limits" $values.container.resources.limits )) "terminationMessagePath" "/dev/termination-log" "terminationMessagePolicy" "File" "volumeMounts" (get (fromJson (include "connectors.volumeMountss" (dict "a" (list $values) ))) "r") ))) "dnsPolicy" "ClusterFirst" "restartPolicy" $values.deployment.restartPolicy "schedulerName" $values.deployment.schedulerName "nodeSelector" $values.deployment.nodeSelector "imagePullSecrets" $values.imagePullSecrets "securityContext" $values.deployment.securityContext "tolerations" $values.deployment.tolerations "topologySpreadConstraints" $topologySpreadConstraints "volumes" (get (fromJson (include "connectors.volumes" (dict "a" (list $values) ))) "r") )) )) )) ))) | toJson -}} +{{- (dict "r" $d) | toJson -}} {{- break -}} {{- end -}} {{- end -}} diff --git a/charts/connectors/testdata/template-cases.golden.txtar b/charts/connectors/testdata/template-cases.golden.txtar index 1811b9cee..2f0f7d087 100644 --- a/charts/connectors/testdata/template-cases.golden.txtar +++ b/charts/connectors/testdata/template-cases.golden.txtar @@ -79,8 +79,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -297,8 +296,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -504,8 +502,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -706,8 +703,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -899,8 +895,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -1090,8 +1085,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -1333,8 +1327,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -1526,8 +1519,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -1709,8 +1701,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -1974,8 +1965,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -2202,8 +2192,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -2535,8 +2524,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -2799,8 +2787,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -3006,8 +2993,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -3239,8 +3225,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=1476502274 @@ -3456,8 +3441,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=2065008586 @@ -3792,8 +3776,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -4107,8 +4090,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -4375,8 +4357,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -4563,8 +4544,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1930935263 @@ -4807,8 +4787,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1355681307 @@ -5156,8 +5135,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -5350,8 +5328,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -5644,8 +5621,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=1337396066 @@ -6003,8 +5979,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1300816856 @@ -6526,8 +6501,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1153123375 @@ -6858,8 +6832,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=1885084612 @@ -7220,8 +7193,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=1444795321 @@ -7554,8 +7526,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1022927047 @@ -7883,8 +7854,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-1621274024 @@ -8437,8 +8407,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=871084350 @@ -8956,8 +8925,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=660248664 @@ -9338,8 +9306,7 @@ spec: podAntiAffinity: null automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=-2097692565 @@ -9671,8 +9638,7 @@ spec: topologyKey: "" automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -9861,8 +9827,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -10067,8 +10032,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -10293,8 +10257,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -10483,8 +10446,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -10675,8 +10637,7 @@ spec: weight: 100 automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 diff --git a/charts/redpanda/testdata/template-cases.golden.txtar b/charts/redpanda/testdata/template-cases.golden.txtar index 135e89f6f..16e3927f7 100644 --- a/charts/redpanda/testdata/template-cases.golden.txtar +++ b/charts/redpanda/testdata/template-cases.golden.txtar @@ -53532,8 +53532,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -69194,8 +69193,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083 @@ -110769,8 +110767,7 @@ spec: topologyKey: kubernetes.io/hostname automountServiceAccountToken: false containers: - - command: null - env: + - env: - name: CONNECT_CONFIGURATION value: |- rest.advertised.port=8083