Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Add optional hubot-scripts volume to st2chatops pod. To add this, define `st2chatops.hubotScriptsVolume`. (#207) (by @cognifloyd)
* Add advanced pod placment (nodeSelector, affinity, tolerations) to specs for batch Jobs pods. (#193) (by @cognifloyd)
* Allow adding dnsPolicy and/or dnsConfig to all pods. (#201) (by @cognifloyd)
* Move st2-config-vol volume definition and list of st2-config-vol volumeMounts to helpers to reduce duplication (#198) (by @cognifloyd)

## v0.60.0
* Switch st2 version to `v3.5dev` as a new latest development version (#187)
Expand Down
15 changes: 15 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ Create the name of the stackstorm-ha service account to use
{{- end -}}
{{- end -}}

# Reduce duplication of the st2.*.conf volume details
{{- define "st2-config-volume-mounts" -}}
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- end -}}
{{- define "st2-config-volume" -}}
- name: st2-config-vol
configMap:
name: {{ $.Release.Name }}-st2-config
{{- end -}}

{{- define "init-containers-wait-for-db" -}}
{{- if index .Values "mongodb" "enabled" }}
{{- $mongodb_port := (int (index .Values "mongodb" "service" "port")) }}
Expand Down
132 changes: 24 additions & 108 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
- name: htpasswd-vol
mountPath: /etc/st2/htpasswd
subPath: htpasswd
Expand All @@ -97,9 +92,7 @@ spec:
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
- name: htpasswd-vol
emptyDir:
medium: Memory
Expand Down Expand Up @@ -181,12 +174,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
{{- if .Values.st2.datastore_crypto_key }}
- name: st2-encryption-key-vol
mountPath: /etc/st2/keys
Expand Down Expand Up @@ -214,9 +202,7 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.st2.packs.images }}
{{- include "packs-volumes" . | indent 8 }}
{{- end }}
Expand Down Expand Up @@ -291,21 +277,14 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
resources:
{{- toYaml .Values.st2stream.resources | nindent 10 }}
{{- if .Values.st2stream.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -477,21 +456,14 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
resources:
{{- toYaml .Values.st2rulesengine.resources | nindent 10 }}
{{- if .Values.st2rulesengine.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.st2.datastore_crypto_key }}
- name: st2-encryption-key-vol
secret:
Expand Down Expand Up @@ -570,21 +542,14 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
resources:
{{- toYaml .Values.st2timersengine.resources | nindent 10 }}
{{- if .Values.st2timersengine.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -655,12 +620,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
{{- if .Values.st2.datastore_crypto_key }}
- name: st2-encryption-key-vol
mountPath: /etc/st2/keys
Expand All @@ -672,9 +632,7 @@ spec:
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.st2.datastore_crypto_key }}
- name: st2-encryption-key-vol
secret:
Expand Down Expand Up @@ -752,12 +710,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
{{- if .Values.st2.datastore_crypto_key }}
- name: st2-encryption-key-vol
mountPath: /etc/st2/keys
Expand All @@ -777,9 +730,7 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -849,21 +800,14 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
resources:
{{- toYaml .Values.st2notifier.resources | nindent 10 }}
{{- if .Values.st2notifier.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -959,12 +903,7 @@ spec:
- configMapRef:
name: {{ $.Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" $ | nindent 8 }}
{{- if $.Values.st2.packs.images }}
- name: st2-packs-vol
mountPath: /opt/stackstorm/packs
Expand Down Expand Up @@ -992,9 +931,7 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
- name: st2-config-vol
configMap:
name: {{ $.Release.Name }}-st2-config
{{- include "st2-config-volume" $ | nindent 8 }}
{{- if $.Values.st2.packs.images }}
{{- include "packs-volumes" $ | indent 8 }}
{{- end }}
Expand Down Expand Up @@ -1081,12 +1018,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
- name: st2-ssh-key-vol
mountPath: /home/stanley/.ssh/
readOnly: true
Expand Down Expand Up @@ -1117,9 +1049,7 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
- name: st2-ssh-key-vol
secret:
secretName: {{ .Release.Name }}-st2-ssh
Expand Down Expand Up @@ -1200,21 +1130,14 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
resources:
{{- toYaml .Values.st2garbagecollector.resources | nindent 10 }}
{{- if .Values.st2garbagecollector.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -1322,12 +1245,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
{{- if .Values.st2.rbac.enabled }}
- name: st2-rbac-roles-vol
mountPath: /opt/stackstorm/rbac/roles/
Expand Down Expand Up @@ -1373,9 +1291,7 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
{{- if .Values.st2.rbac.enabled }}
- name: st2-rbac-roles-vol
configMap:
Expand Down
33 changes: 6 additions & 27 deletions templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ spec:
- --config-file=/etc/st2/st2.docker.conf
- --config-file=/etc/st2/st2.user.conf
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
- name: st2-rbac-roles-vol
mountPath: /opt/stackstorm/rbac/roles/
- name: st2-rbac-assignments-vol
Expand All @@ -64,9 +59,7 @@ spec:
# TODO: Find out default resource limits for this specific service (#5)
#resources:
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
- name: st2-rbac-roles-vol
configMap:
name: {{ .Release.Name }}-st2-rbac-roles
Expand Down Expand Up @@ -304,12 +297,7 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
- name: st2client-config-vol
mountPath: /root/.st2/
- name: st2-kv-vol
Expand All @@ -318,9 +306,7 @@ spec:
# TODO: Find out default resource limits for this specific service (#5)
#resources:
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
- name: st2client-config-vol
emptyDir:
medium: Memory
Expand Down Expand Up @@ -403,12 +389,7 @@ spec:
- --register-all
- --register-fail-on-failure
volumeMounts:
- name: st2-config-vol
mountPath: /etc/st2/st2.docker.conf
subPath: st2.docker.conf
- name: st2-config-vol
mountPath: /etc/st2/st2.user.conf
subPath: st2.user.conf
{{- include "st2-config-volume-mounts" . | nindent 8 }}
- name: st2-pack-configs-vol
mountPath: /opt/stackstorm/configs/
{{- if .Values.st2.packs.images }}
Expand All @@ -420,9 +401,7 @@ spec:
# TODO: Find out default resource limits for this specific service (#5)
#resources:
volumes:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- include "st2-config-volume" . | nindent 8 }}
- name: st2-pack-configs-vol
configMap:
name: {{ .Release.Name }}-st2-pack-configs
Expand Down