Skip to content

Commit 53f700e

Browse files
authored
Merge pull request #356 from guzzijones/alternate_registry
configurable utilityImage + clusterDomain and increase default db timeouts to avoid replicaset timeout
2 parents d55e668 + 3f0601a commit 53f700e

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

templates/_helpers.tpl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ app.kubernetes.io/name: {{ $name }}
3939
app.kubernetes.io/instance: {{ $root.Release.Name }}
4040
{{- end -}}
4141

42+
{{/*
43+
Generate Docker utility image line
44+
*/}}
45+
{{- define "stackstorm-ha.utilityImage" -}}
46+
{{- if .Values.image.utilityImage -}}
47+
{{ .Values.image.utilityImage }}
48+
{{- else -}}
49+
docker.io/library/busybox:1.28
50+
{{- end -}}
51+
{{- end -}}
52+
53+
4254
{{/*
4355
Generate Docker image repository: Public Docker Hub 'stackstorm' for FOSS version
4456
*/}}
@@ -91,7 +103,7 @@ Generate comma-separated list of nodes for MongoDB-HA connection string, based o
91103
{{- range $index0 := until $replicas -}}
92104
{{- $index1 := $index0 | add1 -}}
93105
{{- if eq $architecture "replicaset" }}
94-
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}-headless{{ if ne $index1 $replicas }},{{ end }}
106+
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}{{ if ne $index1 $replicas }},{{ end }}
95107
{{- else }}
96108
{{- $mongo_fullname }}-{{ $index0 }}.{{ $mongo_fullname }}{{ if ne $index1 $replicas }},{{ end }}
97109
{{- end -}}
@@ -110,9 +122,9 @@ Generate list of nodes for Redis with Sentinel connection string, based on numbe
110122
{{- $sentinel_port := (index .Values "redis" "sentinel" "port") }}
111123
{{- range $index0 := until $replicas -}}
112124
{{- if eq $index0 0 -}}
113-
{{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless:{{ $sentinel_port }}?sentinel={{ $master_name }}
125+
{{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}:{{ $sentinel_port }}?sentinel={{ $master_name }}
114126
{{- else -}}
115-
&sentinel_fallback={{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless:{{ $sentinel_port }}
127+
&sentinel_fallback={{ $.Release.Name }}-redis-node-{{ $index0 }}.{{ $.Release.Name }}-redis-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}:{{ $sentinel_port }}
116128
{{- end -}}
117129
{{- end -}}
118130
{{- end -}}
@@ -165,7 +177,7 @@ Reduce duplication of the st2.*.conf volume details
165177
{{- if index .Values "mongodb" "enabled" }}
166178
{{- $mongodb_port := (int (index .Values "mongodb" "service" "port")) }}
167179
- name: wait-for-db
168-
image: busybox:1.28
180+
image: {{ template "stackstorm-ha.utilityImage" . }}
169181
command:
170182
- 'sh'
171183
- '-c'
@@ -185,7 +197,7 @@ Reduce duplication of the st2.*.conf volume details
185197
{{- if index .Values "rabbitmq" "enabled" }}
186198
{{- $rabbitmq_port := (int (index .Values "rabbitmq" "service" "port")) }}
187199
- name: wait-for-queue
188-
image: busybox:1.28
200+
image: {{ template "stackstorm-ha.utilityImage" . }}
189201
command:
190202
- 'sh'
191203
- '-c'

templates/deployments.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ spec:
11381138
initContainers:
11391139
{{- if $some_sensors_per_pod }}
11401140
- name: {{ $name }}-init-config
1141-
image: busybox:1.28
1141+
image: '{{ template "stackstorm-ha.utilityImage" $ }}'
11421142
volumeMounts:
11431143
- name: st2-sensor-config-vol
11441144
mountPath: /tmp/st2

templates/jobs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ spec:
134134
initContainers:
135135
{{- include "stackstorm-ha.init-containers-wait-for-db" . | nindent 6 }}
136136
- name: wait-for-api
137-
image: busybox:1.28
137+
image: {{ template "stackstorm-ha.utilityImage" . }}
138138
{{- with .Values.securityContext }}
139139
securityContext: {{- toYaml . | nindent 10 }}
140140
{{- end }}

values.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
## Docker image settings, applied to all StackStorm pods
66
##
77
image:
8+
# utility image to use as sidecar for running startup scripts
9+
# allows you to override the registry namespace as well if you are using a private registry
10+
# ie
11+
# utilityImage: "myprivateregsistry.local/ext.docker.io/library/busybox:1.28"
12+
utilityImage: ""
813
# Image pull policy
914
pullPolicy: IfNotPresent
1015
# st2 image repository. Set this to override the default ("stackstorm").
@@ -20,7 +25,13 @@ image:
2025
# See: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
2126
#pullSecret: "your-pull-secret"
2227

23-
28+
##
29+
## local cluster domain suffix to enable fqdn lookups for redis, mongo
30+
## kube-dns defaults to cluster.local and allows override with --domain
31+
## core-dns has no default but allows config in k8 configmap
32+
## https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#configuration-of-stub-domain-and-upstream-nameserver-using-coredns
33+
##
34+
clusterDomain: cluster.local
2435

2536
##
2637
## Service Account
@@ -70,6 +81,11 @@ st2:
7081
config: |
7182
[api]
7283
allow_origin = '*'
84+
# fixes no replicaset found bug;
85+
[database]
86+
# Connection and server selection timeout (in ms).
87+
connection_timeout = 5000
88+
7389
7490
#Override Definitions can be added here.
7591
#https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults

0 commit comments

Comments
 (0)