Skip to content

Commit 9405a74

Browse files
committed
Allow adding dnsPolicy, dnsConfig to all pods
1 parent 1bd0ab3 commit 9405a74

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

templates/deployments.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ spec:
103103
- name: htpasswd-vol
104104
emptyDir:
105105
medium: Memory
106+
{{- if .Values.dnsPolicy }}
107+
dnsPolicy: {{ .Values.dnsPolicy }}
108+
{{- end }}
109+
{{- with .Values.dnsConfig }}
110+
dnsConfig: {{- toYaml . | nindent 8 }}
111+
{{- end }}
106112
{{- with .Values.st2auth.nodeSelector }}
107113
nodeSelector: {{- toYaml . | nindent 8 }}
108114
{{- end }}
@@ -214,6 +220,12 @@ spec:
214220
{{- if .Values.st2.packs.images }}
215221
{{- include "packs-volumes" . | indent 8 }}
216222
{{- end }}
223+
{{- if .Values.dnsPolicy }}
224+
dnsPolicy: {{ .Values.dnsPolicy }}
225+
{{- end }}
226+
{{- with .Values.dnsConfig }}
227+
dnsConfig: {{- toYaml . | nindent 8 }}
228+
{{- end }}
217229
{{- with .Values.st2api.nodeSelector }}
218230
nodeSelector: {{- toYaml . | nindent 8 }}
219231
{{- end }}
@@ -294,6 +306,12 @@ spec:
294306
- name: st2-config-vol
295307
configMap:
296308
name: {{ .Release.Name }}-st2-config
309+
{{- if .Values.dnsPolicy }}
310+
dnsPolicy: {{ .Values.dnsPolicy }}
311+
{{- end }}
312+
{{- with .Values.dnsConfig }}
313+
dnsConfig: {{- toYaml . | nindent 8 }}
314+
{{- end }}
297315
{{- with .Values.st2stream.nodeSelector }}
298316
nodeSelector: {{- toYaml . | nindent 8 }}
299317
{{- end }}
@@ -390,6 +408,12 @@ spec:
390408
{{- else }}
391409
volumes: []
392410
{{- end }}
411+
{{- if .Values.dnsPolicy }}
412+
dnsPolicy: {{ .Values.dnsPolicy }}
413+
{{- end }}
414+
{{- with .Values.dnsConfig }}
415+
dnsConfig: {{- toYaml . | nindent 8 }}
416+
{{- end }}
393417
{{- with .Values.st2web.nodeSelector }}
394418
nodeSelector: {{- toYaml . | nindent 8 }}
395419
{{- end }}
@@ -476,6 +500,12 @@ spec:
476500
- key: datastore_crypto_key
477501
path: datastore_key.json
478502
{{- end }}
503+
{{- if .Values.dnsPolicy }}
504+
dnsPolicy: {{ .Values.dnsPolicy }}
505+
{{- end }}
506+
{{- with .Values.dnsConfig }}
507+
dnsConfig: {{- toYaml . | nindent 8 }}
508+
{{- end }}
479509
{{- with .Values.st2rulesengine.nodeSelector }}
480510
nodeSelector: {{- toYaml . | nindent 8 }}
481511
{{- end }}
@@ -555,6 +585,12 @@ spec:
555585
- name: st2-config-vol
556586
configMap:
557587
name: {{ .Release.Name }}-st2-config
588+
{{- if .Values.dnsPolicy }}
589+
dnsPolicy: {{ .Values.dnsPolicy }}
590+
{{- end }}
591+
{{- with .Values.dnsConfig }}
592+
dnsConfig: {{- toYaml . | nindent 8 }}
593+
{{- end }}
558594
{{- with .Values.st2timersengine.nodeSelector }}
559595
nodeSelector: {{- toYaml . | nindent 8 }}
560596
{{- end }}
@@ -647,6 +683,12 @@ spec:
647683
- key: datastore_crypto_key
648684
path: datastore_key.json
649685
{{- end }}
686+
{{- if .Values.dnsPolicy }}
687+
dnsPolicy: {{ .Values.dnsPolicy }}
688+
{{- end }}
689+
{{- with .Values.dnsConfig }}
690+
dnsConfig: {{- toYaml . | nindent 8 }}
691+
{{- end }}
650692
{{- with .Values.st2workflowengine.nodeSelector }}
651693
nodeSelector: {{- toYaml . | nindent 8 }}
652694
{{- end }}
@@ -738,6 +780,12 @@ spec:
738780
- name: st2-config-vol
739781
configMap:
740782
name: {{ .Release.Name }}-st2-config
783+
{{- if .Values.dnsPolicy }}
784+
dnsPolicy: {{ .Values.dnsPolicy }}
785+
{{- end }}
786+
{{- with .Values.dnsConfig }}
787+
dnsConfig: {{- toYaml . | nindent 8 }}
788+
{{- end }}
741789
{{- with .Values.st2scheduler.nodeSelector }}
742790
nodeSelector: {{- toYaml . | nindent 8 }}
743791
{{- end }}
@@ -816,6 +864,12 @@ spec:
816864
- name: st2-config-vol
817865
configMap:
818866
name: {{ .Release.Name }}-st2-config
867+
{{- if .Values.dnsPolicy }}
868+
dnsPolicy: {{ .Values.dnsPolicy }}
869+
{{- end }}
870+
{{- with .Values.dnsConfig }}
871+
dnsConfig: {{- toYaml . | nindent 8 }}
872+
{{- end }}
819873
{{- with .Values.st2notifier.nodeSelector }}
820874
nodeSelector: {{- toYaml . | nindent 8 }}
821875
{{- end }}
@@ -944,6 +998,12 @@ spec:
944998
{{- if $.Values.st2.packs.images }}
945999
{{- include "packs-volumes" $ | indent 8 }}
9461000
{{- end }}
1001+
{{- if $.Values.dnsPolicy }}
1002+
dnsPolicy: {{ $.Values.dnsPolicy }}
1003+
{{- end }}
1004+
{{- with $.Values.dnsConfig }}
1005+
dnsConfig: {{- toYaml . | nindent 8 }}
1006+
{{- end }}
9471007
{{- with .nodeSelector }}
9481008
nodeSelector: {{- toYaml . | nindent 8 }}
9491009
{{- end }}
@@ -1071,6 +1131,12 @@ spec:
10711131
{{- if .Values.st2.packs.images }}
10721132
{{- include "packs-volumes" . | indent 8 }}
10731133
{{- end }}
1134+
{{- if .Values.dnsPolicy }}
1135+
dnsPolicy: {{ .Values.dnsPolicy }}
1136+
{{- end }}
1137+
{{- with .Values.dnsConfig }}
1138+
dnsConfig: {{- toYaml . | nindent 8 }}
1139+
{{- end }}
10741140
{{- with .Values.st2actionrunner.nodeSelector }}
10751141
nodeSelector: {{- toYaml . | nindent 8 }}
10761142
{{- end }}
@@ -1149,6 +1215,12 @@ spec:
11491215
- name: st2-config-vol
11501216
configMap:
11511217
name: {{ .Release.Name }}-st2-config
1218+
{{- if .Values.dnsPolicy }}
1219+
dnsPolicy: {{ .Values.dnsPolicy }}
1220+
{{- end }}
1221+
{{- with .Values.dnsConfig }}
1222+
dnsConfig: {{- toYaml . | nindent 8 }}
1223+
{{- end }}
11521224
{{- with .Values.st2garbagecollector.nodeSelector }}
11531225
nodeSelector: {{- toYaml . | nindent 8 }}
11541226
{{- end }}
@@ -1420,6 +1492,12 @@ spec:
14201492
- name: st2-chatops-hubot-scripts-vol
14211493
{{- toYaml .Values.st2chatops.hubotScriptsVolume | nindent 10 }}
14221494
{{- end }}
1495+
{{- if .Values.dnsPolicy }}
1496+
dnsPolicy: {{ .Values.dnsPolicy }}
1497+
{{- end }}
1498+
{{- with .Values.dnsConfig }}
1499+
dnsConfig: {{- toYaml . | nindent 8 }}
1500+
{{- end }}
14231501
{{- with .Values.st2chatops.nodeSelector }}
14241502
nodeSelector: {{- toYaml . | nindent 8 }}
14251503
{{- end }}

templates/jobs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ spec:
7777
configMap:
7878
name: {{ .Release.Name }}-st2-rbac-mappings
7979
restartPolicy: OnFailure
80+
{{- if .Values.dnsPolicy }}
81+
dnsPolicy: {{ .Values.dnsPolicy }}
82+
{{- end }}
83+
{{- with .Values.dnsConfig }}
84+
dnsConfig: {{- toYaml . | nindent 8 }}
85+
{{- end }}
8086
{{- with .Values.jobs.nodeSelector }}
8187
nodeSelector: {{- toYaml . | nindent 8 }}
8288
{{- end }}
@@ -197,6 +203,12 @@ spec:
197203
secret:
198204
secretName: {{ .Release.Name }}-st2-apikeys
199205
restartPolicy: OnFailure
206+
{{- if .Values.dnsPolicy }}
207+
dnsPolicy: {{ .Values.dnsPolicy }}
208+
{{- end }}
209+
{{- with .Values.dnsConfig }}
210+
dnsConfig: {{- toYaml . | nindent 8 }}
211+
{{- end }}
200212
{{- with .Values.jobs.nodeSelector }}
201213
nodeSelector: {{- toYaml . | nindent 8 }}
202214
{{- end }}
@@ -316,6 +328,12 @@ spec:
316328
secret:
317329
secretName: {{ .Release.Name }}-st2-kv
318330
restartPolicy: OnFailure
331+
{{- if .Values.dnsPolicy }}
332+
dnsPolicy: {{ .Values.dnsPolicy }}
333+
{{- end }}
334+
{{- with .Values.dnsConfig }}
335+
dnsConfig: {{- toYaml . | nindent 8 }}
336+
{{- end }}
319337
{{- with .Values.jobs.nodeSelector }}
320338
nodeSelector: {{- toYaml . | nindent 8 }}
321339
{{- end }}
@@ -410,6 +428,12 @@ spec:
410428
name: {{ .Release.Name }}-st2-pack-configs
411429
{{- include "packs-volumes" $ | nindent 8 }}
412430
restartPolicy: OnFailure
431+
{{- if .Values.dnsPolicy }}
432+
dnsPolicy: {{ .Values.dnsPolicy }}
433+
{{- end }}
434+
{{- with .Values.dnsConfig }}
435+
dnsConfig: {{- toYaml . | nindent 8 }}
436+
{{- end }}
413437
{{- with .Values.jobs.nodeSelector }}
414438
nodeSelector: {{- toYaml . | nindent 8 }}
415439
{{- end }}

values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,25 @@ redis:
654654
metrics:
655655
enabled: false
656656

657+
##
658+
## Settings to be applied to all stackstorm-ha pods
659+
##
660+
# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
661+
# "ClusterFirst" is the default. Other options: "Default", "ClusterFirstWithHostNet", "None"
662+
#dnsPolicy: "ClusterFirst"
663+
# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
664+
dnsConfig: {}
665+
# example copied from the docs
666+
#nameservers:
667+
#- 1.2.3.4
668+
#searches:
669+
#- ns1.svc.cluster-domain.example
670+
#- my.dns.search.suffix
671+
#options:
672+
#- name: ndots
673+
# value: "2"
674+
#- name: edns0
675+
657676
##
658677
## External DNS configuration (3rd party chart dependency)
659678
##

0 commit comments

Comments
 (0)