Skip to content

Commit f47b7b1

Browse files
authored
Merge pull request #141 from Sheshagiri/master
support for custom st2actionrunner images via values.yaml
2 parents 6190e00 + a3bd690 commit f47b7b1

File tree

5 files changed

+680
-16
lines changed

5 files changed

+680
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Refactor label definitions to be more consistent by building labels and label selectors in partial helper templates. (#299) (by @cognifloyd)
66
* Use the correct `apiVersion` for `Ingress` to add support for Kubernetes `v1.22`. (#301) (by @arms11)
77
* Fix mounts for `jobs.preRegisterContentCommand` container to use the same mounts as the primary register-content container. (#322) (by @cognifloyd)
8+
* Add support for providing custom st2actionrunner-specific docker repository, image name, pull policy, and pull secret via `values.yaml`. (#141) (by @Sheshagiri)
89

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

templates/deployments.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,9 @@ spec:
12921292
{{- if .Values.st2.packs.images }}
12931293
{{- include "stackstorm-ha.packs-pullSecrets" . | nindent 6 }}
12941294
{{- end }}
1295+
{{- if .Values.st2actionrunner.image.pullSecret }}
1296+
- name: {{ .Values.st2actionrunner.image.pullSecret }}
1297+
{{- end }}
12951298
initContainers:
12961299
{{- include "stackstorm-ha.init-containers-wait-for-db" . | nindent 6 }}
12971300
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
@@ -1300,8 +1303,10 @@ spec:
13001303
{{- end }}
13011304
containers:
13021305
- name: st2actionrunner
1303-
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2actionrunner.image.tag | default .Values.image.tag) . }}'
1304-
imagePullPolicy: {{ .Values.image.pullPolicy }}
1306+
{{- with .Values.st2actionrunner }}
1307+
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2actionrunner" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
1308+
{{- end }}
1309+
imagePullPolicy: {{ .Values.st2actionrunner.image.pullPolicy | default .Values.image.pullPolicy }}
13051310
{{- with default .Values.securityContext .Values.st2actionrunner.securityContext }}
13061311
securityContext: {{- toYaml . | nindent 10 }}
13071312
{{- end }}
@@ -1719,7 +1724,9 @@ spec:
17191724
{{- end }}
17201725
containers:
17211726
- name: st2chatops
1722-
image: '{{ .Values.st2chatops.image.repository | default "stackstorm" }}/{{ .Values.st2chatops.image.name | default "st2chatops" }}:{{ tpl (.Values.st2chatops.image.tag | default .Values.image.tag) . }}'
1727+
{{- with .Values.st2chatops }}
1728+
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2chatops" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
1729+
{{- end }}
17231730
imagePullPolicy: {{ .Values.st2chatops.image.pullPolicy | default .Values.image.pullPolicy }}
17241731
{{- with .Values.securityContext }}
17251732
securityContext: {{- toYaml . | nindent 10 }}

tests/unit/image_pull_test.yaml

Lines changed: 98 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ templates:
2424
# image.pullPolicy
2525
# serviceAccount.pullPolicy
2626
# st2.packs.images[].pullPolicy
27-
# imagePullSecreets
27+
# st2actionrunner.image.pullPolicy
28+
# imagePullSecrets
2829
# image.pullSecret
2930
# serviceAccount.pullSecret
3031
# st2.packs.images[].pullSecret
32+
# st2actionrunner.image.pullSecret
3133

3234
tests:
3335
- it: Deployments and Jobs use default pullPolicy and pullSecret
@@ -80,9 +82,9 @@ tests:
8082
- deployments.yaml
8183
- jobs.yaml
8284
set:
83-
image:
84-
pullPolicy: Always
85-
pullSecret: custom-pull-secret
85+
image: &globalCustomImage
86+
pullPolicy: &globalCustomImagePullPolicy Always
87+
pullSecret: &globalCustomImagePullSecret custom-pull-secret
8688
serviceAccount:
8789
create: true
8890
# show that this does not affect pod specs
@@ -95,16 +97,104 @@ tests:
9597
jobs:
9698
extra_hooks: *jobs_extra_hooks
9799
asserts:
98-
- equal:
100+
- equal: &eq_custom_pull_secret
99101
path: spec.template.spec.imagePullSecrets[0].name
100-
value: custom-pull-secret
102+
value: *globalCustomImagePullSecret
103+
- equal: &eq_custom_pull_policy
104+
path: spec.template.spec.containers[0].imagePullPolicy
105+
value: *globalCustomImagePullPolicy
106+
# path can only select one element, not all initContainers (if present).
107+
#- equal:
108+
# path: 'spec.template.spec.initContainers[].imagePullPolicy'
109+
# value: *globalCustomImagePullPolicy
110+
111+
# this is only for st2actionrunner for now
112+
- it: Deployments use custom Deployment-specific pullPolicy and pullSecret
113+
templates:
114+
- deployments.yaml
115+
set:
116+
image: *globalCustomImage
117+
st2actionrunner:
118+
image:
119+
pullPolicy: Never
120+
pullSecret: custom-st2actionrunner-pull-secret
121+
st2:
122+
packs: { sensors: [] } # ensure only 1 sensor
123+
st2chatops:
124+
enabled: true
125+
asserts:
126+
- hasDocuments:
127+
count: 14
128+
129+
- equal: *eq_custom_pull_secret
130+
documentIndex: 0
131+
- equal: *eq_custom_pull_secret
132+
documentIndex: 1 # st2api
133+
- equal: *eq_custom_pull_secret
134+
documentIndex: 2
135+
- equal: *eq_custom_pull_secret
136+
documentIndex: 3
137+
- equal: *eq_custom_pull_secret
138+
documentIndex: 4
139+
- equal: *eq_custom_pull_secret
140+
documentIndex: 5
141+
- equal: *eq_custom_pull_secret
142+
documentIndex: 6
143+
- equal: *eq_custom_pull_secret
144+
documentIndex: 7
145+
- equal: *eq_custom_pull_secret
146+
documentIndex: 8
147+
- equal: *eq_custom_pull_secret
148+
documentIndex: 9 # st2sensorcontainer
149+
- equal: *eq_custom_pull_secret
150+
documentIndex: 10 # st2actionrunner
151+
- contains:
152+
path: spec.template.spec.imagePullSecrets
153+
content:
154+
name: custom-st2actionrunner-pull-secret
155+
documentIndex: 10 # st2actionrunner
156+
- equal: *eq_custom_pull_secret
157+
documentIndex: 11
158+
- equal: *eq_custom_pull_secret
159+
documentIndex: 12 # st2client
160+
- equal: *eq_custom_pull_secret
161+
documentIndex: 13
162+
101163
- equal:
102164
path: spec.template.spec.containers[0].imagePullPolicy
103-
value: Always
165+
value: Never
166+
documentIndex: 10 # st2actionrunner
167+
- equal: *eq_custom_pull_policy
168+
documentIndex: 0
169+
- equal: *eq_custom_pull_policy
170+
documentIndex: 1 # st2api
171+
- equal: *eq_custom_pull_policy
172+
documentIndex: 2
173+
- equal: *eq_custom_pull_policy
174+
documentIndex: 3
175+
- equal: *eq_custom_pull_policy
176+
documentIndex: 4
177+
- equal: *eq_custom_pull_policy
178+
documentIndex: 5
179+
- equal: *eq_custom_pull_policy
180+
documentIndex: 6
181+
- equal: *eq_custom_pull_policy
182+
documentIndex: 7
183+
- equal: *eq_custom_pull_policy
184+
documentIndex: 8
185+
- equal: *eq_custom_pull_policy
186+
documentIndex: 9 # st2sensorcontainer
187+
- equal: *eq_custom_pull_policy
188+
documentIndex: 11
189+
- equal: *eq_custom_pull_policy
190+
documentIndex: 12 # st2client
191+
- equal: *eq_custom_pull_policy
192+
documentIndex: 13
193+
104194
# path can only select one element, not all initContainers (if present).
105195
#- equal:
106196
# path: 'spec.template.spec.initContainers[].imagePullPolicy'
107-
# value: Always
197+
# value: *globalCustomImagePullPolicy
108198

109199
- it: ServiceAccount has no imagePullSecret by default
110200
template: service-account.yaml

0 commit comments

Comments
 (0)