Skip to content

Commit

Permalink
Use separate appId instead of pass through option
Browse files Browse the repository at this point in the history
  • Loading branch information
torbsto committed Feb 20, 2024
1 parent 981ab00 commit b86810e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions charts/streams-app-cleanup-job/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/streams-app-cleanup-job/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions charts/streams-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
14 changes: 9 additions & 5 deletions charts/streams-app/templates/scaled-object.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -44,16 +48,16 @@ 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 }}
{{- range .Values.autoscaling.topics }}
- 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 }}
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/streams-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -47,6 +46,7 @@ streams:
# role: output
# errorTopic: error
# productive: true
appId: my-app-id

commandLine: {}
# MY_CLI_PARAM: "foo-bar"
Expand Down

0 comments on commit b86810e

Please sign in to comment.