Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 18 additions & 6 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ app.kubernetes.io/name: {{ $name }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
{{- end -}}

{{/*
Generate Docker image registry: container registry
*/}}
{{- define "stackstorm-ha.imageRegistry" -}}
{{- if .Values.image.registry -}}
{{ .Values.image.registry }}
{{- else -}}
'docker.io'
{{- end -}}
{{- end -}}


{{/*
Generate Docker image repository: Public Docker Hub 'stackstorm' for FOSS version
*/}}
Expand Down Expand Up @@ -91,7 +103,7 @@ Generate comma-separated list of nodes for MongoDB-HA connection string, based o
{{- range $index0 := until $replicas -}}
{{- $index1 := $index0 | add1 -}}
{{- if eq $architecture "replicaset" }}
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}-headless{{ if ne $index1 $replicas }},{{ end }}
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}-headless.{{ $.Release.Namespace }}.svc.cluster.local{{ if ne $index1 $replicas }},{{ end }}
{{- else }}
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}{{ if ne $index1 $replicas }},{{ end }}
{{- end -}}
Expand All @@ -110,9 +122,9 @@ Generate list of nodes for Redis with Sentinel connection string, based on numbe
{{- $sentinel_port := (index .Values "redis" "sentinel" "port") }}
{{- range $index0 := until $replicas -}}
{{- if eq $index0 0 -}}
{{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless:{{ $sentinel_port }}?sentinel={{ $master_name }}
{{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless.{{ $.Release.Namespace }}.svc.cluster.local:{{ $sentinel_port }}?sentinel={{ $master_name }}
{{- else -}}
&sentinel_fallback={{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless:{{ $sentinel_port }}
&sentinel_fallback={{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless.{{ $.Release.Namespace }}.svc.cluster.local:{{ $sentinel_port }}
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down Expand Up @@ -165,7 +177,7 @@ Reduce duplication of the st2.*.conf volume details
{{- if index .Values "mongodb" "enabled" }}
{{- $mongodb_port := (int (index .Values "mongodb" "service" "port")) }}
- name: wait-for-db
image: busybox:1.28
image: {{ template "stackstorm-ha.imageRegistry" . }}/library/busybox:1.28
command:
- 'sh'
- '-c'
Expand All @@ -185,7 +197,7 @@ Reduce duplication of the st2.*.conf volume details
{{- if index .Values "rabbitmq" "enabled" }}
{{- $rabbitmq_port := (int (index .Values "rabbitmq" "service" "port")) }}
- name: wait-for-queue
image: busybox:1.28
image: {{ template "stackstorm-ha.imageRegistry" . }}/library/busybox:1.28
command:
- 'sh'
- '-c'
Expand Down Expand Up @@ -296,7 +308,7 @@ Merge packs and virtualenvs from st2 with those from st2packs images
{{- if $.Values.st2.packs.images }}
{{- range $.Values.st2.packs.images }}
- name: 'st2-custom-pack-{{ printf "%s-%s-%s" .repository .name .tag | sha1sum }}'
image: "{{ .repository }}/{{ .name }}:{{ .tag }}"
image: "{{ .registry }}/{{ .repository }}/{{ .name }}:{{ .tag }}"
imagePullPolicy: {{ .pullPolicy | quote }}
volumeMounts:
- name: st2-packs-vol
Expand Down
34 changes: 17 additions & 17 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
# Sidecar container for generating .htpasswd with st2 username & password pair and sharing produced file with the main st2auth container
- name: generate-htpasswd
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2auth:{{ tpl (.Values.st2auth.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2auth:{{ tpl (.Values.st2auth.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand All @@ -62,7 +62,7 @@ spec:
- printf "${ST2_AUTH_USERNAME}:$(openssl passwd -apr1 "${ST2_AUTH_PASSWORD}")\n" > /tmp/st2/htpasswd
containers:
- name: st2auth
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2auth:{{ tpl (.Values.st2auth.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2auth:{{ tpl (.Values.st2auth.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -181,7 +181,7 @@ spec:
{{- end }}
containers:
- name: st2api
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2api:{{ tpl (.Values.st2api.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2api:{{ tpl (.Values.st2api.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -307,7 +307,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2stream
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2stream:{{ tpl (.Values.st2stream.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2stream:{{ tpl (.Values.st2stream.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -407,7 +407,7 @@ spec:
{{- end }}
containers:
- name: st2web
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2web:{{ tpl (.Values.st2web.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2web:{{ tpl (.Values.st2web.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2web.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -541,7 +541,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2rulesengine
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2rulesengine:{{ tpl (.Values.st2rulesengine.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2rulesengine:{{ tpl (.Values.st2rulesengine.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -658,7 +658,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2timersengine
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2timersengine:{{ tpl (.Values.st2timersengine.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2timersengine:{{ tpl (.Values.st2timersengine.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -762,7 +762,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2workflowengine
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2workflowengine:{{ tpl (.Values.st2workflowengine.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2workflowengine:{{ tpl (.Values.st2workflowengine.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -878,7 +878,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2scheduler
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2scheduler:{{ tpl (.Values.st2scheduler.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2scheduler:{{ tpl (.Values.st2scheduler.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -994,7 +994,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2notifier
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2notifier:{{ tpl (.Values.st2notifier.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2notifier:{{ tpl (.Values.st2notifier.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -1138,7 +1138,7 @@ spec:
initContainers:
{{- if $some_sensors_per_pod }}
- name: {{ $name }}-init-config
image: busybox:1.28
image: '{{ template "stackstorm-ha.imageRegistry" $ }}/library/busybox:1.28'
volumeMounts:
- name: st2-sensor-config-vol
mountPath: /tmp/st2
Expand All @@ -1160,7 +1160,7 @@ spec:
{{- end }}
containers:
- name: {{ $name }}
image: '{{ template "stackstorm-ha.imageRepository" $ }}/st2sensorcontainer:{{ tpl ($sensor.image.tag | default $.Values.image.tag) $ }}'
image: '{{ template "stackstorm-ha.imageRegistry" $ }}/{{ template "stackstorm-ha.imageRepository" $ }}/st2sensorcontainer:{{ tpl ($sensor.image.tag | default $.Values.image.tag) $ }}'
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with default $.Values.securityContext $sensor.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -1324,7 +1324,7 @@ spec:
containers:
- name: st2actionrunner
{{- with .Values.st2actionrunner }}
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2actionrunner" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
image: '{{ .image.registry | default (include "stackstorm-ha.imageRegistry" $) }}/{{ .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 }}
Expand Down Expand Up @@ -1459,7 +1459,7 @@ spec:
{{- include "stackstorm-ha.init-containers-wait-for-mq" . | nindent 6 }}
containers:
- name: st2garbagecollector
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2garbagecollector:{{ tpl (.Values.st2garbagecollector.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2garbagecollector:{{ tpl (.Values.st2garbagecollector.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -1572,7 +1572,7 @@ spec:
{{- end }}
# Sidecar container for generating st2client config with st2 username & password pair and sharing produced file with the main container
- name: generate-st2client-config
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default (.Values.st2actionrunner.image.tag | default .Values.image.tag)) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default (.Values.st2actionrunner.image.tag | default .Values.image.tag)) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand All @@ -1599,7 +1599,7 @@ spec:
EOT
containers:
- name: st2client
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default .Values.image.tag) . }}'
image: '{{ template "stackstorm-ha.imageRegistry" . }}/{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2actionrunner.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
Expand Down Expand Up @@ -1749,7 +1749,7 @@ spec:
containers:
- name: st2chatops
{{- with .Values.st2chatops }}
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2chatops" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
image: '{{ .image.registry | default (include "stackstorm-ha.imageRegistry" $) }}/{{ .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 }}
Expand Down
Loading