Skip to content

Commit b927e4b

Browse files
committed
Allow setting an api_key for st2chatops instead of user/pass
1 parent ed8f5fb commit b927e4b

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

templates/deployments.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,13 @@ spec:
13771377
image: '{{ .Values.st2chatops.image.repository | default "stackstorm" }}/{{ .Values.st2chatops.image.name | default "st2chatops" }}:{{ tpl (.Values.st2chatops.image.tag | default .Chart.AppVersion) . }}'
13781378
imagePullPolicy: {{ .Values.st2chatops.image.pullPolicy | default .Values.image.pullPolicy }}
13791379
env:
1380+
{{- if index .Values.st2chatops "use_api_key" }}
1381+
- name: ST2_API_KEY
1382+
valueFrom:
1383+
secretKeyRef:
1384+
name: {{ .Release.Name }}-st2-auth
1385+
key: chatops_api_key
1386+
{{- else }}
13801387
- name: ST2_AUTH_USERNAME
13811388
valueFrom:
13821389
secretKeyRef:
@@ -1387,6 +1394,7 @@ spec:
13871394
secretKeyRef:
13881395
name: {{ .Release.Name }}-st2-auth
13891396
key: password
1397+
{{- end }}
13901398
envFrom:
13911399
- configMapRef:
13921400
name: {{ .Release.Name }}-st2-urls

templates/secrets_st2auth.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ data:
1818
username: {{ required "A valid secret 'st2.username' is required for StackStorm auth!" .Values.secrets.st2.username | b64enc | quote }}
1919
# Password, used to login to StackStorm system (default: Ch@ngeMe)
2020
password: {{ required "A valid secret 'st2.password' is required for StackStorm auth!" .Values.secrets.st2.password | b64enc | quote }}
21+
{{- if index .Values.st2chatops "use_api_key" }}
22+
# Optional api_key for chatops to use instead of username/password
23+
chatops_api_key: {{ required "A valid secret 'st2.chatops_api_key' is required for StackStorm Chatops auth!" .Values.secrets.st2.api_key | b64enc | quote }}
24+
{{- end }}

values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ st2chatops:
422422
env:
423423
HUBOT_ADAPTER: slack
424424
HUBOT_SLACK_TOKEN: xoxb-CHANGE-ME-PLEASE
425+
# If use_api_key is true, then use secrets.st2.api_key instead of username/password for chatops
426+
# to authenticate with StackStorm.
427+
use_api_key: false
425428
# Set custom generated st2chatops Docker image source
426429
# Otherwise default https://hub.docker.com/r/stackstorm/st2chatops is used
427430
image: {}

0 commit comments

Comments
 (0)