From b86810e10570613f8ebcd2064b390b8e8c2920d6 Mon Sep 17 00:00:00 2001 From: Torben Meyer Date: Tue, 20 Feb 2024 06:01:47 +0100 Subject: [PATCH] Use separate appId instead of pass through option --- charts/streams-app-cleanup-job/templates/job.yaml | 4 ++-- charts/streams-app-cleanup-job/values.yaml | 2 +- charts/streams-app/templates/deployment.yaml | 4 ++-- charts/streams-app/templates/scaled-object.yaml | 14 +++++++++----- charts/streams-app/values.yaml | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/charts/streams-app-cleanup-job/templates/job.yaml b/charts/streams-app-cleanup-job/templates/job.yaml index 4c413a3e..90413af3 100644 --- a/charts/streams-app-cleanup-job/templates/job.yaml +++ b/charts/streams-app-cleanup-job/templates/job.yaml @@ -112,9 +112,9 @@ spec: - name: "{{ .Values.configurationEnvPrefix }}_EXTRA_INPUT_PATTERNS" value: "{{- range $key, $value := .Values.streams.extraInputPatterns }}{{ $key }}={{ $value }},{{- end }}" {{- end }} - {{- if and (.Values.streams.passApplicationId) (hasKey .Values.autoscaling "consumerGroup") }} + {{- if .Values.streams.appId }} - name: "{{ .Values.configurationEnvPrefix }}_UNIQUE_APP_ID" - value: {{ .Values.autoscaling.consumerGroup | quote }} + value: {{ .Values.streams.appId | quote }} {{- end }} {{- range $key, $value := .Values.secrets }} - name: "{{ $key }}" diff --git a/charts/streams-app-cleanup-job/values.yaml b/charts/streams-app-cleanup-job/values.yaml index 164e37ab..a4312715 100644 --- a/charts/streams-app-cleanup-job/values.yaml +++ b/charts/streams-app-cleanup-job/values.yaml @@ -15,7 +15,7 @@ configurationEnvPrefix: "APP" streams: # brokers: "test:9092" # schemaRegistryUrl: "url:1234" - passApplicationId: true + appId: my-app-id config: {} # max.poll.records: 500 # Note that YAML may convert large integers to scientific notation. Use Strings to avoid this. diff --git a/charts/streams-app/templates/deployment.yaml b/charts/streams-app/templates/deployment.yaml index 897ba33a..a9974684 100644 --- a/charts/streams-app/templates/deployment.yaml +++ b/charts/streams-app/templates/deployment.yaml @@ -175,9 +175,9 @@ spec: - name: "{{ .Values.configurationEnvPrefix }}_EXTRA_INPUT_PATTERNS" value: "{{- range $key, $value := .Values.streams.extraInputPatterns }}{{ $key }}={{ $value }},{{- end }}" {{- end }} - {{- if and (.Values.streams.passApplicationId) (hasKey .Values.autoscaling "consumerGroup") }} + {{- if .Values.streams.appId }} - name: "{{ .Values.configurationEnvPrefix }}_UNIQUE_APP_ID" - value: {{ .Values.autoscaling.consumerGroup | quote }} + value: {{ .Values.streams.appId | quote }} {{- end }} {{- range $key, $value := .Values.secrets }} - name: "{{ $key }}" diff --git a/charts/streams-app/templates/scaled-object.yaml b/charts/streams-app/templates/scaled-object.yaml index 85b23303..6cce81f2 100644 --- a/charts/streams-app/templates/scaled-object.yaml +++ b/charts/streams-app/templates/scaled-object.yaml @@ -1,4 +1,8 @@ {{ if .Values.autoscaling.enabled }} +{{- if and (.Values.streams.appId) (.Values.autoscaling.consumerGroup) -}} +{{- fail "streams.appId and autoscaling.consumerGroup are mutually exclusive. You can use use streams.appId for apps 2.17.0+. If you don't want to set your app id via Helm or you're using an older version, but still want to use KEDA autoscaling, set autoscaling.consumerGroup" -}} +{{- end -}} +{{- $consumerGroup := coalesce .Values.streams.appId .Values.autoscaling.consumerGroup -}} {{- $root := . -}} apiVersion: keda.sh/v1alpha1 kind: ScaledObject @@ -35,7 +39,7 @@ spec: - type: kafka metadata: bootstrapServers: {{ $root.Values.streams.brokers }} - consumerGroup: {{ $root.Values.autoscaling.consumerGroup }} + consumerGroup: {{ $consumerGroup }} topic: {{ . | quote }} lagThreshold: {{ $root.Values.autoscaling.lagThreshold | quote }} offsetResetPolicy: {{ $root.Values.autoscaling.offsetResetPolicy }} @@ -44,8 +48,8 @@ spec: - type: kafka metadata: bootstrapServers: {{ $root.Values.streams.brokers }} - consumerGroup: {{ $root.Values.autoscaling.consumerGroup }} - topic: {{ printf "%s-%s" $root.Values.autoscaling.consumerGroup . | quote }} + consumerGroup: {{ $consumerGroup }} + topic: {{ printf "%s-%s" $consumerGroup . | quote }} lagThreshold: {{ $root.Values.autoscaling.lagThreshold | quote }} offsetResetPolicy: {{ $root.Values.autoscaling.offsetResetPolicy }} {{- end }} @@ -53,7 +57,7 @@ spec: - type: kafka metadata: bootstrapServers: {{ $root.Values.streams.brokers }} - consumerGroup: {{ $root.Values.autoscaling.consumerGroup }} + consumerGroup: {{ $consumerGroup }} topic: {{ . | quote }} lagThreshold: {{ $root.Values.autoscaling.lagThreshold | quote }} offsetResetPolicy: {{ $root.Values.autoscaling.offsetResetPolicy }} @@ -63,7 +67,7 @@ spec: - type: kafka metadata: bootstrapServers: {{ $root.Values.streams.brokers }} - consumerGroup: {{ $root.Values.autoscaling.consumerGroup }} + consumerGroup: {{ $consumerGroup }} topic: {{ $topic | quote }} lagThreshold: {{ $root.Values.autoscaling.lagThreshold | quote }} offsetResetPolicy: {{ $root.Values.autoscaling.offsetResetPolicy }} diff --git a/charts/streams-app/values.yaml b/charts/streams-app/values.yaml index 3954a377..9e6045f2 100644 --- a/charts/streams-app/values.yaml +++ b/charts/streams-app/values.yaml @@ -27,7 +27,6 @@ streams: # schemaRegistryUrl: "url:1234" staticMembership: false optimizeLeaveGroupBehavior: true - passApplicationId: true config: {} # max.poll.records: 500 # Note that YAML may convert large integers to scientific notation. Use Strings to avoid this. @@ -47,6 +46,7 @@ streams: # role: output # errorTopic: error # productive: true + appId: my-app-id commandLine: {} # MY_CLI_PARAM: "foo-bar"