From f35d014276a1fa0bc92e0d0fbd85c4bc1ba28ea9 Mon Sep 17 00:00:00 2001 From: chgl Date: Wed, 24 Jan 2024 18:17:51 +0100 Subject: [PATCH] added config to set kafka topics as an array --- charts/stream-processors/Chart.yaml | 6 +++--- charts/stream-processors/templates/_helpers.tpl | 5 +++++ charts/stream-processors/templates/deployment.yaml | 12 ++++++++++++ charts/stream-processors/values-test.yaml | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/charts/stream-processors/Chart.yaml b/charts/stream-processors/Chart.yaml index 3dec3893..890f19aa 100644 --- a/charts/stream-processors/Chart.yaml +++ b/charts/stream-processors/Chart.yaml @@ -8,7 +8,7 @@ keywords: - kafka - strimzi kafka operator - stream processing -version: 1.3.0 +version: 1.4.0 annotations: artifacthub.io/recommendations: | - url: https://artifacthub.io/packages/helm/strimzi/strimzi-kafka-operator @@ -16,5 +16,5 @@ annotations: # When using the list of objects option the valid supported kinds are # added, changed, deprecated, removed, fixed and security. artifacthub.io/changes: | - - kind: changed - description: refreshed docs with latest helm-docs + - kind: added + description: config option `*.kafka.topics` to set the `KAFKA_TOPICS` env var from an array diff --git a/charts/stream-processors/templates/_helpers.tpl b/charts/stream-processors/templates/_helpers.tpl index 9e7b08cb..c63260c3 100644 --- a/charts/stream-processors/templates/_helpers.tpl +++ b/charts/stream-processors/templates/_helpers.tpl @@ -51,3 +51,8 @@ version label value {{- $tagAsString | quote }} {{- end }} {{- end }} + +{{- define "stream-processors.utils.joinListWithComma" -}} +{{- $local := dict "first" true -}} +{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} +{{- end -}} diff --git a/charts/stream-processors/templates/deployment.yaml b/charts/stream-processors/templates/deployment.yaml index de668a6f..60a48cde 100644 --- a/charts/stream-processors/templates/deployment.yaml +++ b/charts/stream-processors/templates/deployment.yaml @@ -91,6 +91,18 @@ spec: secretKeyRef: name: {{ $.Values.strimziClusterName }}-cluster-ca-cert key: ca.password + {{- with .kafka }} + {{- if .topics }} + - name: TOPICS + value: {{ include "stream-processors.utils.joinListWithComma" .topics }} + - name: TOPIC + value: {{ include "stream-processors.utils.joinListWithComma" .topics }} + - name: KAFKA_TOPICS + value: {{ include "stream-processors.utils.joinListWithComma" .topics }} + - name: KAFKA_TOPIC + value: {{ include "stream-processors.utils.joinListWithComma" .topics }} + {{- end }} + {{- end }} {{- if .container.env -}} {{- toYaml .container.env | default "" | nindent 12 }} {{- end }} diff --git a/charts/stream-processors/values-test.yaml b/charts/stream-processors/values-test.yaml index 87cbb6b9..e9717e6e 100644 --- a/charts/stream-processors/values-test.yaml +++ b/charts/stream-processors/values-test.yaml @@ -63,6 +63,11 @@ processors: additionalLabels: release: prom replicaCount: 1 + kafka: + topics: + - test-1 + - test-2 + - test-3 container: image: registry: ghcr.io