Skip to content

Commit

Permalink
Use args for CLI parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Jul 22, 2024
1 parent 3c8880c commit 1ee2c3c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 50 deletions.
100 changes: 51 additions & 49 deletions charts/streams-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,57 @@ spec:
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
resources:
{{ toYaml .Values.resources | indent 12 }}
args:
{{- if not .Values.statefulSet }}
- --volatile-group-instance-id
{{- end }}
{{- if hasKey .Values.streams "brokers" }}
- --brokers
- {{ .Values.streams.brokers | quote }}
{{- end }}
{{- if hasKey .Values.streams "schemaRegistryUrl" }}
- --schema-registry-url
- {{ .Values.streams.schemaRegistryUrl | quote }}
{{- end }}
{{- if hasKey .Values "debug" }}
- --debug
- {{ .Values.debug | quote }}
{{- end }}
{{- range .Values.streams.inputTopics }}
- --input-topics
- {{ . | quote }}
{{- end }}
{{- if hasKey .Values.streams "inputPattern" }}
- --input-pattern
- {{ .Values.streams.inputPattern | quote }}
{{- end }}
{{- if hasKey .Values.streams "outputTopic" }}
- --output-topic
- {{ .Values.streams.outputTopic | quote }}
{{- end }}
{{- if hasKey .Values.streams "errorTopic" }}
- --error-topic
- {{ .Values.streams.errorTopic | quote }}
{{- end }}
{{- range $key, $value := .Values.streams.extraOutputTopics }}
- --extra-output-topics
- {{ $key }}={{ $value }}
{{- end }}
{{- range $key, $value := .Values.streams.extraInputTopics }}
- --extra-input-topics
- {{ $key }}={{ $value | join ";" }}
{{- end }}
{{- range $key, $value := .Values.streams.extraInputPatterns }}
- --extra-input-patterns
- {{ $key }}={{ $value }}
{{- end }}
{{- range $key, $value := .Values.commandLine }}
- {{ $key | quote }}
- {{ $value | quote }}
{{- end }}
{{- range .Values.commandLineList }}
- {{ . | quote }}
{{- end }}
env:
- name: ENV_PREFIX
value: {{ .Values.configurationEnvPrefix }}_
Expand Down Expand Up @@ -111,51 +162,6 @@ spec:
- name: KAFKA_JMX_PORT
value: "{{ .Values.jmx.port }}"
{{- end }}
{{- if not .Values.statefulSet }}
- name: "{{ .Values.configurationEnvPrefix }}_VOLATILE_GROUP_INSTANCE_ID"
value: "true"
{{- end }}
{{- if hasKey .Values.streams "brokers" }}
- name: "{{ .Values.configurationEnvPrefix }}_BROKERS"
value: {{ .Values.streams.brokers | quote }}
{{- end }}
{{- if hasKey .Values.streams "schemaRegistryUrl" }}
- name: "{{ .Values.configurationEnvPrefix }}_SCHEMA_REGISTRY_URL"
value: {{ .Values.streams.schemaRegistryUrl | quote }}
{{- end }}
{{- if hasKey .Values "debug" }}
- name: "{{ .Values.configurationEnvPrefix }}_DEBUG"
value: {{ .Values.debug | quote }}
{{- end }}
{{- if and (hasKey .Values.streams "inputTopics") (.Values.streams.inputTopics) }}
- name: "{{ .Values.configurationEnvPrefix }}_INPUT_TOPICS"
value: {{ .Values.streams.inputTopics | join "," | quote }}
{{- end }}
{{- if hasKey .Values.streams "inputPattern" }}
- name: "{{ .Values.configurationEnvPrefix }}_INPUT_PATTERN"
value: {{ .Values.streams.inputPattern | quote }}
{{- end }}
{{- if hasKey .Values.streams "outputTopic" }}
- name: "{{ .Values.configurationEnvPrefix }}_OUTPUT_TOPIC"
value: {{ .Values.streams.outputTopic | quote }}
{{- end }}
{{- if hasKey .Values.streams "errorTopic" }}
- name: "{{ .Values.configurationEnvPrefix }}_ERROR_TOPIC"
value: {{ .Values.streams.errorTopic | quote }}
{{- end }}
{{- if and (hasKey .Values.streams "extraOutputTopics") (.Values.streams.extraOutputTopics) }}
- name: "{{ .Values.configurationEnvPrefix }}_EXTRA_OUTPUT_TOPICS"
value: "{{- range $key, $value := .Values.streams.extraOutputTopics }}{{ $key }}={{ $value }},{{- end }}"
{{- end }}
{{- $delimiter := ";" }}
{{- if and (hasKey .Values.streams "extraInputTopics") (.Values.streams.extraInputTopics) }}
- name: "{{ .Values.configurationEnvPrefix }}_EXTRA_INPUT_TOPICS"
value: "{{- range $key, $value := .Values.streams.extraInputTopics }}{{ $key }}={{ $value | join $delimiter }},{{- end }}"
{{- end }}
{{- if and (hasKey .Values.streams "extraInputPatterns") (.Values.streams.extraInputPatterns) }}
- name: "{{ .Values.configurationEnvPrefix }}_EXTRA_INPUT_PATTERNS"
value: "{{- range $key, $value := .Values.streams.extraInputPatterns }}{{ $key }}={{ $value }},{{- end }}"
{{- end }}
{{- range $key, $value := .Values.secrets }}
- name: "{{ $key }}"
valueFrom:
Expand All @@ -170,10 +176,6 @@ spec:
name: {{ $value.name }}
key: "{{ $value.key }}"
{{- end }}
{{- range $key, $value := .Values.commandLine }}
- name: "{{ $root.Values.configurationEnvPrefix }}_{{ $key }}"
value: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key | quote }}
value: {{ $value | quote }}
Expand Down
5 changes: 4 additions & 1 deletion charts/streams-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ streams:
# errorTopic: error

commandLine: {}
# MY_CLI_PARAM: "foo-bar"
# --my-cli-param: "foo-bar"
commandLineList: []
# - --my-cli-param
# - foo-bar

debug: false

Expand Down

0 comments on commit 1ee2c3c

Please sign in to comment.