Skip to content

Commit 63a4449

Browse files
committed
Enable Extra Volumes in Jobs
1 parent a2a9e1c commit 63a4449

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Add ability to create custom labels for service account.(#327)(by @SuganJoe)
1111
* Fix bug that would not set the appropriate redis connection string when using `redis.password` and `redis.usePassword` (#325) (by @rebrowning)
1212
* New Feature: Add `existingConfigSecret`. If this is defined, the `st2.secrets.conf` key within this secret will be written as /etc/st2/st2.secrets.conf and added to the end of the command line arguments of all pods. (#289) (by @eric-al/@ericreeves)
13+
* New Feature: Add `extra_volumes` to all python-based st2 jobs. (by @bmarick)
1314

1415
## v0.100.0
1516
* Switch st2 to `v3.7` as a new default stable version (#274)

templates/jobs.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ spec:
5858
mountPath: /opt/stackstorm/rbac/assignments/
5959
- name: st2-rbac-mappings-vol
6060
mountPath: /opt/stackstorm/rbac/mappings/
61+
{{- range .Values.jobs.extra_volumes }}
62+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
63+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
64+
{{- end }}
6165
# TODO: Find out default resource limits for this specific service (#5)
6266
#resources:
6367
volumes:
@@ -71,6 +75,10 @@ spec:
7175
- name: st2-rbac-mappings-vol
7276
configMap:
7377
name: {{ .Release.Name }}-st2-rbac-mappings
78+
{{- range .Values.jobs.extra_volumes }}
79+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
80+
{{- tpl (required "Each volume must have a 'volume' definition in jobs.extra_volumes" .volume | toYaml) $ | nindent 10 }}
81+
{{- end }}
7482
restartPolicy: OnFailure
7583
{{- if .Values.dnsPolicy }}
7684
dnsPolicy: {{ .Values.dnsPolicy }}
@@ -156,6 +164,10 @@ spec:
156164
volumeMounts:
157165
- name: st2client-config-vol
158166
mountPath: /root/.st2/
167+
{{- range .Values.jobs.extra_volumes }}
168+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
169+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
170+
{{- end }}
159171
# `st2 login` doesn't exit on failure correctly, use old methods instead. See bug: https://github.com/StackStorm/st2/issues/4338
160172
command:
161173
- 'sh'
@@ -192,6 +204,10 @@ spec:
192204
- name: st2-apikeys-vol
193205
mountPath: /etc/st2/apikeys.yaml
194206
subPath: apikeys.yaml
207+
{{- range .Values.jobs.extra_volumes }}
208+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
209+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
210+
{{- end }}
195211
# TODO: Find out default resource limits for this specific service (#5)
196212
#resources:
197213
volumes:
@@ -201,6 +217,10 @@ spec:
201217
- name: st2-apikeys-vol
202218
secret:
203219
secretName: {{ .Release.Name }}-st2-apikeys
220+
{{- range .Values.jobs.extra_volumes }}
221+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
222+
{{- tpl (required "Each volume must have a 'volume' definition in jobs.extra_volumes" .volume | toYaml) $ | nindent 10 }}
223+
{{- end }}
204224
restartPolicy: OnFailure
205225
{{- if .Values.dnsPolicy }}
206226
dnsPolicy: {{ .Values.dnsPolicy }}
@@ -274,6 +294,10 @@ spec:
274294
volumeMounts:
275295
- name: st2client-config-vol
276296
mountPath: /root/.st2/
297+
{{- range .Values.jobs.extra_volumes }}
298+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
299+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
300+
{{- end }}
277301
# `st2 login` doesn't exit on failure correctly, use old methods instead. See bug: https://github.com/StackStorm/st2/issues/4338
278302
command:
279303
- 'sh'
@@ -312,6 +336,10 @@ spec:
312336
- name: st2-kv-vol
313337
mountPath: /etc/st2/st2kv.yaml
314338
subPath: st2kv.yaml
339+
{{- range .Values.jobs.extra_volumes }}
340+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
341+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
342+
{{- end }}
315343
# TODO: Find out default resource limits for this specific service (#5)
316344
#resources:
317345
volumes:
@@ -322,6 +350,10 @@ spec:
322350
- name: st2-kv-vol
323351
secret:
324352
secretName: {{ .Release.Name }}-st2-kv
353+
{{- range .Values.jobs.extra_volumes }}
354+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
355+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
356+
{{- end }}
325357
restartPolicy: OnFailure
326358
{{- if .Values.dnsPolicy }}
327359
dnsPolicy: {{ .Values.dnsPolicy }}
@@ -396,6 +428,10 @@ spec:
396428
{{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }}
397429
{{- include "stackstorm-ha.pack-configs-volume-mount" . | nindent 8 }}
398430
{{- include "stackstorm-ha.packs-volume-mounts-for-register-job" . | nindent 8 }}
431+
{{- range .Values.jobs.extra_volumes }}
432+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
433+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
434+
{{- end }}
399435
{{ end }}
400436
containers:
401437
- name: st2-register-content
@@ -424,13 +460,21 @@ spec:
424460
{{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }}
425461
{{- include "stackstorm-ha.packs-volume-mounts-for-register-job" . | nindent 8 }}
426462
{{- include "stackstorm-ha.pack-configs-volume-mount" . | nindent 8 }}
463+
{{- range .Values.jobs.extra_volumes }}
464+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
465+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
466+
{{- end }}
427467
# TODO: Find out default resource limits for this specific service (#5)
428468
#resources:
429469
volumes:
430470
{{- include "stackstorm-ha.overrides-configs" . | nindent 8 }}
431471
{{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }}
432472
{{- include "stackstorm-ha.packs-volumes" . | nindent 8 }}
433473
{{- include "stackstorm-ha.pack-configs-volume" . | nindent 8 }}
474+
{{- range .Values.jobs.extra_volumes }}
475+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
476+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
477+
{{- end }}
434478
restartPolicy: OnFailure
435479
{{- if .Values.dnsPolicy }}
436480
dnsPolicy: {{ .Values.dnsPolicy }}
@@ -511,6 +555,10 @@ spec:
511555
volumeMounts:
512556
- name: st2client-config-vol
513557
mountPath: /root/.st2/
558+
{{- range .Values.jobs.extra_volumes }}
559+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
560+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
561+
{{- end }}
514562
# `st2 login` doesn't exit on failure correctly, use old methods instead. See bug: https://github.com/StackStorm/st2/issues/4338
515563
command:
516564
- 'sh'
@@ -548,6 +596,10 @@ spec:
548596
{{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }}
549597
{{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }}
550598
{{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }}
599+
{{- range .Values.jobs.extra_volumes }}
600+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
601+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
602+
{{- end }}
551603
{{- if .resources }}
552604
resources: {{- toYaml .resources | nindent 10 }}
553605
{{- end }}
@@ -559,6 +611,10 @@ spec:
559611
{{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }}
560612
{{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }}
561613
{{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }}
614+
{{- range .Values.jobs.extra_volumes }}
615+
- name: {{ required "Each volume must have a 'name' in jobs.extra_volumes" .name }}
616+
{{- tpl (required "Each volume must have a 'mount' definition in jobs.extra_volumes" .mount | toYaml) $ | nindent 10 }}
617+
{{- end }}
562618
restartPolicy: OnFailure
563619
{{- if $.Values.dnsPolicy }}
564620
dnsPolicy: {{ $.Values.dnsPolicy }}

values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ st2:
8888

8989

9090
# Custom StackStorm config (st2.secrets.conf) which will be created from the key 'st2.secrets.conf' within this secret.
91-
# If this is defined, '--config-file=/etc/st2/st2.secrets.conf' will be added to the end of the command line arguments
91+
# If this is defined, '--config-file=/etc/st2/st2.secrets.conf' will be added to the end of the command line arguments
9292
# for all pods, superseding all other configuration values.
9393
# This secret must be populated outside of this chart.
9494
# existingConfigSecret: stackstorm-config-secret
@@ -919,6 +919,10 @@ jobs:
919919
# HTTP_PROXY: http://proxy:1234
920920
## These named secrets (managed outside this chart) will be added to envFrom.
921921
envFromSecrets: []
922+
# mount extra volumes on the st2web pod(s) (primarily useful for k8s-provisioned secrets)
923+
## Note that Helm templating is supported in 'mount' and 'volume'
924+
extra_volumes: []
925+
# see examples under st2actionrunner.extra_volumes
922926
#
923927
# Advanced controls to skip creating jobs.
924928
# This is useful in targeted upgrades with `--set`. Do not set this in values files.

0 commit comments

Comments
 (0)