Skip to content

Commit

Permalink
added config to set kafka topics as an array (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
chgl authored Jan 24, 2024
1 parent 74ddf3c commit 389dc3a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions charts/stream-processors/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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
- url: https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
# 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
5 changes: 5 additions & 0 deletions charts/stream-processors/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
12 changes: 12 additions & 0 deletions charts/stream-processors/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 5 additions & 0 deletions charts/stream-processors/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ processors:
additionalLabels:
release: prom
replicaCount: 1
kafka:
topics:
- test-1
- test-2
- test-3
container:
image:
registry: ghcr.io
Expand Down

0 comments on commit 389dc3a

Please sign in to comment.