Skip to content

Commit dceceed

Browse files
authored
Merge pull request #307 from cwilson21/master
Issue #306 : Adding the ability to use overrides
2 parents fd4e222 + fb10e50 commit dceceed

19 files changed

+245
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Switch st2 to `v3.7` as a new default stable version (#274)
55
* Upgrade MongoDB `v4.0` -> `v4.4` as 4.0 has reached its EOL. (#304)
66
* Migrate from `python 3.6` `Ubuntu Bionic` to `python 3.8` `Ubuntu Focal` as a base StackStorm OS (StackStorm/st2-dockerfiles#54)
7+
* Add support for use of overrides that are available in `v3.7` of st2 via helm charts. (#306)
78

89
## v0.90.0
910
* Advanced Feature: Make securityContext (on Deployments/Jobs) and podSecurityContext (on Pods) configurable. This allows dropping all capabilities, for example. You can override the securityContext for `st2actionrunner`, `st2sensorcontainer`, and `st2client` if your actions or sensors need, for example, additional capabilites that the rest of StackStorm does not need. (#271) (by @cognifloyd)

templates/_helpers.tpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ define this here as well to simplify comparison with packs-volume-mounts
210210
{{- end }}
211211
{{- end -}}
212212

213+
#Inserted for override ability to happen via helm charts
214+
215+
{{- define "stackstorm-ha.overrides-config-mounts" -}}
216+
{{- if .Values.st2.overrides }}
217+
- name: st2-overrides-vol
218+
mountPath: /opt/stackstorm/overrides
219+
{{- end }}
220+
{{- end -}}
221+
222+
{{- define "stackstorm-ha.overrides-configs" -}}
223+
{{- if .Values.st2.overrides }}
224+
- name: st2-overrides-vol
225+
configMap:
226+
name: {{ .Release.Name }}-st2-overrides-configs
227+
{{- end }}
228+
{{- end -}}
229+
213230
{{/*
214231
For custom st2packs-initContainers reduce duplicity by defining them here once
215232
Merge packs and virtualenvs from st2 with those from st2packs images

templates/configmaps_overrides.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if .Values.st2.overrides }}
2+
---
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: {{ .Release.Name }}-st2-overrides-configs
7+
annotations:
8+
description: StackStorm override configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/overrides'
9+
labels:
10+
app: st2
11+
tier: backend
12+
vendor: stackstorm
13+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
14+
release: {{ .Release.Name }}
15+
heritage: {{ .Release.Service }}
16+
data:
17+
{{ toYaml .Values.st2.overrides | indent 2 }}
18+
{{- end }}

templates/deployments.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,9 @@ spec:
17001700
checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }}
17011701
checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }}
17021702
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
1703+
{{- if .Values.st2.overrides }}
1704+
checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }}
1705+
{{- end }}
17031706
{{- if .Values.st2client.postStartScript }}
17041707
checksum/post-start-script: {{ .Values.st2client.postStartScript | sha256sum }}
17051708
{{- end }}
@@ -1773,6 +1776,7 @@ spec:
17731776
- name: st2-rbac-mappings-vol
17741777
mountPath: /opt/stackstorm/rbac/mappings/
17751778
{{- end }}
1779+
{{- include "stackstorm-ha.overrides-config-mounts" . | nindent 8 }}
17761780
- name: st2client-config-vol
17771781
mountPath: /root/.st2/
17781782
- name: st2-ssh-key-vol
@@ -1824,6 +1828,7 @@ spec:
18241828
configMap:
18251829
name: {{ .Release.Name }}-st2-rbac-mappings
18261830
{{- end }}
1831+
{{- include "stackstorm-ha.overrides-configs" . | nindent 8 }}
18271832
- name: st2client-config-vol
18281833
emptyDir:
18291834
medium: Memory

templates/jobs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ spec:
416416
# TODO: Investigate/propose running Helm hook only on condition when ConfigMap or Secret has changed
417417
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
418418
checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }}
419+
{{- if .Values.st2.overrides }}
420+
checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }}
421+
{{- end }}
419422
{{- if .Values.jobs.annotations }}
420423
{{- toYaml .Values.jobs.annotations | nindent 8 }}
421424
{{- end }}
@@ -474,12 +477,14 @@ spec:
474477
{{- end }}
475478
{{- end }}
476479
volumeMounts:
480+
{{- include "stackstorm-ha.overrides-config-mounts" . | nindent 8 }}
477481
{{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }}
478482
{{- include "stackstorm-ha.packs-volume-mounts-for-register-job" . | nindent 8 }}
479483
{{- include "stackstorm-ha.pack-configs-volume-mount" . | nindent 8 }}
480484
# TODO: Find out default resource limits for this specific service (#5)
481485
#resources:
482486
volumes:
487+
{{- include "stackstorm-ha.overrides-configs" . | nindent 8 }}
483488
{{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }}
484489
{{- include "stackstorm-ha.packs-volumes" . | nindent 8 }}
485490
{{- include "stackstorm-ha.pack-configs-volume" . | nindent 8 }}
@@ -540,6 +545,9 @@ spec:
540545
annotations:
541546
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }}
542547
checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }}
548+
{{- if $.Values.st2.overrides }}
549+
checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") $ | sha256sum }}
550+
{{- end }}
543551
{{- if $.Values.jobs.annotations }}
544552
{{- toYaml $.Values.jobs.annotations | nindent 8 }}
545553
{{- end }}
@@ -605,6 +613,7 @@ spec:
605613
volumeMounts:
606614
- name: st2client-config-vol
607615
mountPath: /root/.st2/
616+
{{- include "stackstorm-ha.overrides-config-mounts" $ | nindent 8 }}
608617
{{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }}
609618
{{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }}
610619
{{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }}
@@ -615,6 +624,7 @@ spec:
615624
- name: st2client-config-vol
616625
emptyDir:
617626
medium: Memory
627+
{{- include "stackstorm-ha.overrides-configs" $ | nindent 8 }}
618628
{{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }}
619629
{{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }}
620630
{{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }}

tests/unit/custom_annotations_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ templates:
99
- services.yaml
1010

1111
# included templates must also be listed
12+
- configmaps_overrides.yaml
1213
- configmaps_packs.yaml
1314
- configmaps_rbac.yaml
1415
- configmaps_st2-conf.yaml

tests/unit/dns_test.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ templates:
66
- jobs.yaml
77

88
# included templates must also be listed
9+
- configmaps_overrides.yaml
910
- configmaps_packs.yaml
1011
- configmaps_rbac.yaml
1112
- configmaps_st2-conf.yaml
@@ -23,7 +24,7 @@ tests:
2324
- deployments.yaml
2425
- jobs.yaml
2526
set:
26-
st2:
27+
st2:
2728
packs: { sensors: [] } # ensure only 1 sensor
2829
rbac: { enabled: true } # enable rbac job
2930
jobs:
@@ -54,7 +55,7 @@ tests:
5455
- name: ndots
5556
value: "2"
5657
- name: edns0
57-
st2:
58+
st2:
5859
packs: { sensors: [] } # ensure only 1 sensor
5960
rbac: { enabled: true } # enable rbac job
6061
jobs:

tests/unit/env_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ templates:
66
- jobs.yaml
77

88
# included templates must also be listed
9+
- configmaps_overrides.yaml
910
- configmaps_packs.yaml
1011
- configmaps_rbac.yaml
1112
- configmaps_st2-conf.yaml

tests/unit/image_pull_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ templates:
77
- service-account.yaml
88

99
# included templates must also be listed
10+
- configmaps_overrides.yaml
1011
- configmaps_packs.yaml
1112
- configmaps_rbac.yaml
1213
- configmaps_st2-conf.yaml

tests/unit/labels_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ templates:
55
- jobs.yaml
66
- services.yaml
77

8+
- configmaps_overrides.yaml
89
- configmaps_packs.yaml
910
- configmaps_post-start-scripts.yaml
1011
- configmaps_rbac.yaml

0 commit comments

Comments
 (0)