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 @@ -5,6 +5,7 @@
* Refactor label definitions to be more consistent by building labels and label selectors in partial helper templates. (#299) (by @cognifloyd)
* Use the correct `apiVersion` for `Ingress` to add support for Kubernetes `v1.22`. (#301) (by @arms11)
* Fix mounts for `jobs.preRegisterContentCommand` container to use the same mounts as the primary register-content container. (#322) (by @cognifloyd)
* Add support for providing custom st2actionrunner-specific docker repository, image name, pull policy, and pull secret via `values.yaml`. (#141) (by @Sheshagiri)

## v0.100.0
* Switch st2 to `v3.7` as a new default stable version (#274)
Expand Down
13 changes: 10 additions & 3 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,9 @@ spec:
{{- if .Values.st2.packs.images }}
{{- include "stackstorm-ha.packs-pullSecrets" . | nindent 6 }}
{{- end }}
{{- if .Values.st2actionrunner.image.pullSecret }}
- name: {{ .Values.st2actionrunner.image.pullSecret }}
{{- end }}
initContainers:
{{- include "stackstorm-ha.init-containers-wait-for-db" . | nindent 6 }}
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
Expand All @@ -1300,8 +1303,10 @@ spec:
{{- end }}
containers:
- name: st2actionrunner
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2actionrunner.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.st2actionrunner }}
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2actionrunner" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
{{- end }}
imagePullPolicy: {{ .Values.st2actionrunner.image.pullPolicy | default .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2actionrunner.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
Expand Down Expand Up @@ -1719,7 +1724,9 @@ spec:
{{- end }}
containers:
- name: st2chatops
image: '{{ .Values.st2chatops.image.repository | default "stackstorm" }}/{{ .Values.st2chatops.image.name | default "st2chatops" }}:{{ tpl (.Values.st2chatops.image.tag | default .Values.image.tag) . }}'
{{- with .Values.st2chatops }}
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2chatops" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
{{- end }}
imagePullPolicy: {{ .Values.st2chatops.image.pullPolicy | default .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down
106 changes: 98 additions & 8 deletions tests/unit/image_pull_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ templates:
# image.pullPolicy
# serviceAccount.pullPolicy
# st2.packs.images[].pullPolicy
# imagePullSecreets
# st2actionrunner.image.pullPolicy
# imagePullSecrets
# image.pullSecret
# serviceAccount.pullSecret
# st2.packs.images[].pullSecret
# st2actionrunner.image.pullSecret

tests:
- it: Deployments and Jobs use default pullPolicy and pullSecret
Expand Down Expand Up @@ -80,9 +82,9 @@ tests:
- deployments.yaml
- jobs.yaml
set:
image:
pullPolicy: Always
pullSecret: custom-pull-secret
image: &globalCustomImage
pullPolicy: &globalCustomImagePullPolicy Always
pullSecret: &globalCustomImagePullSecret custom-pull-secret
serviceAccount:
create: true
# show that this does not affect pod specs
Expand All @@ -95,16 +97,104 @@ tests:
jobs:
extra_hooks: *jobs_extra_hooks
asserts:
- equal:
- equal: &eq_custom_pull_secret
path: spec.template.spec.imagePullSecrets[0].name
value: custom-pull-secret
value: *globalCustomImagePullSecret
- equal: &eq_custom_pull_policy
path: spec.template.spec.containers[0].imagePullPolicy
value: *globalCustomImagePullPolicy
# path can only select one element, not all initContainers (if present).
#- equal:
# path: 'spec.template.spec.initContainers[].imagePullPolicy'
# value: *globalCustomImagePullPolicy

# this is only for st2actionrunner for now
- it: Deployments use custom Deployment-specific pullPolicy and pullSecret
templates:
- deployments.yaml
set:
image: *globalCustomImage
st2actionrunner:
image:
pullPolicy: Never
pullSecret: custom-st2actionrunner-pull-secret
st2:
packs: { sensors: [] } # ensure only 1 sensor
st2chatops:
enabled: true
asserts:
- hasDocuments:
count: 14

- equal: *eq_custom_pull_secret
documentIndex: 0
- equal: *eq_custom_pull_secret
documentIndex: 1 # st2api
- equal: *eq_custom_pull_secret
documentIndex: 2
- equal: *eq_custom_pull_secret
documentIndex: 3
- equal: *eq_custom_pull_secret
documentIndex: 4
- equal: *eq_custom_pull_secret
documentIndex: 5
- equal: *eq_custom_pull_secret
documentIndex: 6
- equal: *eq_custom_pull_secret
documentIndex: 7
- equal: *eq_custom_pull_secret
documentIndex: 8
- equal: *eq_custom_pull_secret
documentIndex: 9 # st2sensorcontainer
- equal: *eq_custom_pull_secret
documentIndex: 10 # st2actionrunner
- contains:
path: spec.template.spec.imagePullSecrets
content:
name: custom-st2actionrunner-pull-secret
documentIndex: 10 # st2actionrunner
- equal: *eq_custom_pull_secret
documentIndex: 11
- equal: *eq_custom_pull_secret
documentIndex: 12 # st2client
- equal: *eq_custom_pull_secret
documentIndex: 13

- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
value: Never
documentIndex: 10 # st2actionrunner
- equal: *eq_custom_pull_policy
documentIndex: 0
- equal: *eq_custom_pull_policy
documentIndex: 1 # st2api
- equal: *eq_custom_pull_policy
documentIndex: 2
- equal: *eq_custom_pull_policy
documentIndex: 3
- equal: *eq_custom_pull_policy
documentIndex: 4
- equal: *eq_custom_pull_policy
documentIndex: 5
- equal: *eq_custom_pull_policy
documentIndex: 6
- equal: *eq_custom_pull_policy
documentIndex: 7
- equal: *eq_custom_pull_policy
documentIndex: 8
- equal: *eq_custom_pull_policy
documentIndex: 9 # st2sensorcontainer
- equal: *eq_custom_pull_policy
documentIndex: 11
- equal: *eq_custom_pull_policy
documentIndex: 12 # st2client
- equal: *eq_custom_pull_policy
documentIndex: 13

# path can only select one element, not all initContainers (if present).
#- equal:
# path: 'spec.template.spec.initContainers[].imagePullPolicy'
# value: Always
# value: *globalCustomImagePullPolicy

- it: ServiceAccount has no imagePullSecret by default
template: service-account.yaml
Expand Down
Loading