Skip to content

Commit b0c73e7

Browse files
authored
Merge pull request #262 from cognifloyd/template-st2client-conf
template st2client conf
2 parents d63c4a9 + 9929d15 commit b0c73e7

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Refactor deployments/jobs to inject st2 username/password via `envFrom` instead of via `env`. (#257) (by @cognifloyd)
1313
* New feature: Add `envFromSecrets` to `st2actionrunner`, `st2client`, `st2sensorcontainer`, and jobs. This is useful for adding custom secrets to the environment. This complements the `extra_volumes` feature (loading secrets as files) to facilitate loading secrets that are not easily injected via the filesystem. (#259) (by @cognifloyd)
1414
* New feature to include `nodeSelector`, `affinity` and `tolerations` to `st2client`, allowing more flexibility to pod positioning. (#263) (by @sandesvitor)
15+
* Template `~/.st2/config`. This allows customizing the settings used by the `st2client` and jobs pods for using the st2 apis. (#262) (by @cognifloyd)
1516

1617
## v0.70.0
1718
* New feature: Shared packs volumes `st2.packs.volumes`. Allow using cluster-specific persistent volumes to store packs, virtualenvs, and (optionally) configs. This enables using `st2 pack install`. It even works with `st2packs` images in `st2.packs.images`. (#199) (by @cognifloyd)

templates/deployments.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,10 @@ spec:
14901490
name: {{ .Release.Name }}-st2-urls
14911491
- secretRef:
14921492
name: {{ .Release.Name }}-st2-auth
1493+
{{- range .Values.st2client.envFromSecrets }}
1494+
- secretRef:
1495+
name: {{ . }}
1496+
{{- end }}
14931497
volumeMounts:
14941498
- name: st2client-config-vol
14951499
mountPath: /root/.st2/
@@ -1499,9 +1503,7 @@ spec:
14991503
- '-ec'
15001504
- |
15011505
cat <<EOT > /root/.st2/config
1502-
[credentials]
1503-
username = ${ST2_AUTH_USERNAME}
1504-
password = ${ST2_AUTH_PASSWORD}
1506+
{{- tpl .Values.st2client.st2clientConfig . | nindent 12 }}
15051507
EOT
15061508
containers:
15071509
- name: st2client

templates/jobs.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ spec:
157157
name: {{ .Release.Name }}-st2-urls
158158
- secretRef:
159159
name: {{ .Release.Name }}-st2-auth
160+
{{- range .Values.jobs.envFromSecrets }}
161+
- secretRef:
162+
name: {{ . }}
163+
{{- end }}
160164
volumeMounts:
161165
- name: st2client-config-vol
162166
mountPath: /root/.st2/
@@ -166,9 +170,7 @@ spec:
166170
- '-ec'
167171
- |
168172
cat <<EOT > /root/.st2/config
169-
[credentials]
170-
username = ${ST2_AUTH_USERNAME}
171-
password = ${ST2_AUTH_PASSWORD}
173+
{{- tpl .Values.jobs.st2clientConfig . | nindent 12 }}
172174
EOT
173175
containers:
174176
- name: st2-apikey-load
@@ -273,6 +275,10 @@ spec:
273275
name: {{ .Release.Name }}-st2-urls
274276
- secretRef:
275277
name: {{ .Release.Name }}-st2-auth
278+
{{- range .Values.jobs.envFromSecrets }}
279+
- secretRef:
280+
name: {{ . }}
281+
{{- end }}
276282
volumeMounts:
277283
- name: st2client-config-vol
278284
mountPath: /root/.st2/
@@ -282,9 +288,7 @@ spec:
282288
- '-ec'
283289
- |
284290
cat <<EOT > /root/.st2/config
285-
[credentials]
286-
username = ${ST2_AUTH_USERNAME}
287-
password = ${ST2_AUTH_PASSWORD}
291+
{{- tpl .Values.jobs.st2clientConfig . | nindent 12 }}
288292
EOT
289293
containers:
290294
- name: st2-key-load

values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,15 @@ st2sensorcontainer:
623623
# The st2client deployment/pod simplifies ad-hoc administration.
624624
# st2client is a special purpose actionrunner pod, but you can customize it separately
625625
st2client:
626+
# st2client config (~/.st2/config) template.
627+
# see: https://docs.stackstorm.com/reference/cli.html#configuration-file
628+
# You can access env variables here because this is used in a bash heredoc.
629+
# For example, you could use a var injected with envFromSecrets.
630+
# Note that Helm templating is supported in this block!
631+
st2clientConfig: |
632+
[credentials]
633+
username = ${ST2_AUTH_USERNAME}
634+
password = ${ST2_AUTH_PASSWORD}
626635
env: {}
627636
# HTTP_PROXY: http://proxy:1234
628637
## These named secrets (managed outside this chart) will be added to envFrom.
@@ -729,6 +738,15 @@ st2chatops:
729738
## Various batch jobs (apply-rbac-definitions, apikey-load, key-load, register-content)
730739
##
731740
jobs:
741+
# st2client config (~/.st2/config) template for jobs that need it.
742+
# see: https://docs.stackstorm.com/reference/cli.html#configuration-file
743+
# You can access env variables here because this is used in a bash heredoc.
744+
# For example, you could use a var injected with envFromSecrets.
745+
# Note that Helm templating is supported in this block!
746+
st2clientConfig: |
747+
[credentials]
748+
username = ${ST2_AUTH_USERNAME}
749+
password = ${ST2_AUTH_PASSWORD}
732750
annotations: {}
733751
# Override default image settings (for now, only tag can be overridden)
734752
# The Jobs use the st2actionrunner image

0 commit comments

Comments
 (0)