Skip to content

Commit

Permalink
Merge pull request #356 from guzzijones/alternate_registry
Browse files Browse the repository at this point in the history
configurable utilityImage + clusterDomain and increase default db timeouts to avoid replicaset timeout
  • Loading branch information
cognifloyd authored Feb 22, 2023
2 parents d55e668 + 3f0601a commit 53f700e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
22 changes: 17 additions & 5 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 utility image line
*/}}
{{- define "stackstorm-ha.utilityImage" -}}
{{- if .Values.image.utilityImage -}}
{{ .Values.image.utilityImage }}
{{- else -}}
docker.io/library/busybox:1.28
{{- 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.{{ $.Values.clusterDomain }}{{ 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.{{ $.Values.clusterDomain }}:{{ $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.{{ $.Values.clusterDomain }}:{{ $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.utilityImage" . }}
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.utilityImage" . }}
command:
- 'sh'
- '-c'
Expand Down
2 changes: 1 addition & 1 deletion templates/deployments.yaml
Original file line number Diff line number Diff line change
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.utilityImage" $ }}'
volumeMounts:
- name: st2-sensor-config-vol
mountPath: /tmp/st2
Expand Down
2 changes: 1 addition & 1 deletion templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ spec:
initContainers:
{{- include "stackstorm-ha.init-containers-wait-for-db" . | nindent 6 }}
- name: wait-for-api
image: busybox:1.28
image: {{ template "stackstorm-ha.utilityImage" . }}
{{- with .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
18 changes: 17 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
## Docker image settings, applied to all StackStorm pods
##
image:
# utility image to use as sidecar for running startup scripts
# allows you to override the registry namespace as well if you are using a private registry
# ie
# utilityImage: "myprivateregsistry.local/ext.docker.io/library/busybox:1.28"
utilityImage: ""
# Image pull policy
pullPolicy: IfNotPresent
# st2 image repository. Set this to override the default ("stackstorm").
Expand All @@ -20,7 +25,13 @@ image:
# See: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
#pullSecret: "your-pull-secret"


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

##
## Service Account
Expand Down Expand Up @@ -70,6 +81,11 @@ st2:
config: |
[api]
allow_origin = '*'
# fixes no replicaset found bug;
[database]
# Connection and server selection timeout (in ms).
connection_timeout = 5000
#Override Definitions can be added here.
#https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults
Expand Down

0 comments on commit 53f700e

Please sign in to comment.