Skip to content

Commit

Permalink
Merge pull request #201 from cognifloyd/internal-dns
Browse files Browse the repository at this point in the history
Add optional dnsPolicy, dnsConfig to all pods
  • Loading branch information
arm4b authored Jul 6, 2021
2 parents 1bd0ab3 + 67c4c1e commit d2691ee
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* If your k8s cluster admin requires custom annotations (eg: to indicate mongo or rabbitmq usage), you can now add those to each set of pods. (#195) (by @cognifloyd)
* Add optional hubot-scripts volume to st2chatops pod. To add this, define `st2chatops.hubotScriptsVolume`. (#207) (by @cognifloyd)
* Add advanced pod placment (nodeSelector, affinity, tolerations) to specs for batch Jobs pods. (#193) (by @cognifloyd)
* Allow adding dnsPolicy and/or dnsConfig to all pods. (#201) (by @cognifloyd)

## v0.60.0
* Switch st2 version to `v3.5dev` as a new latest development version (#187)
Expand Down
78 changes: 78 additions & 0 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ spec:
- name: htpasswd-vol
emptyDir:
medium: Memory
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2auth.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -214,6 +220,12 @@ spec:
{{- if .Values.st2.packs.images }}
{{- include "packs-volumes" . | indent 8 }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2api.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -294,6 +306,12 @@ spec:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2stream.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -390,6 +408,12 @@ spec:
{{- else }}
volumes: []
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2web.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -476,6 +500,12 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2rulesengine.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -555,6 +585,12 @@ spec:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2timersengine.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -647,6 +683,12 @@ spec:
- key: datastore_crypto_key
path: datastore_key.json
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2workflowengine.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -738,6 +780,12 @@ spec:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2scheduler.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -816,6 +864,12 @@ spec:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2notifier.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -944,6 +998,12 @@ spec:
{{- if $.Values.st2.packs.images }}
{{- include "packs-volumes" $ | indent 8 }}
{{- end }}
{{- if $.Values.dnsPolicy }}
dnsPolicy: {{ $.Values.dnsPolicy }}
{{- end }}
{{- with $.Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -1071,6 +1131,12 @@ spec:
{{- if .Values.st2.packs.images }}
{{- include "packs-volumes" . | indent 8 }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2actionrunner.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -1149,6 +1215,12 @@ spec:
- name: st2-config-vol
configMap:
name: {{ .Release.Name }}-st2-config
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2garbagecollector.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -1420,6 +1492,12 @@ spec:
- name: st2-chatops-hubot-scripts-vol
{{- toYaml .Values.st2chatops.hubotScriptsVolume | nindent 10 }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2chatops.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
24 changes: 24 additions & 0 deletions templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ spec:
configMap:
name: {{ .Release.Name }}-st2-rbac-mappings
restartPolicy: OnFailure
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -197,6 +203,12 @@ spec:
secret:
secretName: {{ .Release.Name }}-st2-apikeys
restartPolicy: OnFailure
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -316,6 +328,12 @@ spec:
secret:
secretName: {{ .Release.Name }}-st2-kv
restartPolicy: OnFailure
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -410,6 +428,12 @@ spec:
name: {{ .Release.Name }}-st2-pack-configs
{{- include "packs-volumes" $ | nindent 8 }}
restartPolicy: OnFailure
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
19 changes: 19 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,25 @@ redis:
metrics:
enabled: false

##
## Settings to be applied to all stackstorm-ha pods
##
# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
# "ClusterFirst" is the default. Other options: "Default", "ClusterFirstWithHostNet", "None"
#dnsPolicy: "ClusterFirst"
# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
dnsConfig: {}
# example copied from the docs
#nameservers:
#- 1.2.3.4
#searches:
#- ns1.svc.cluster-domain.example
#- my.dns.search.suffix
#options:
#- name: ndots
# value: "2"
#- name: edns0

##
## External DNS configuration (3rd party chart dependency)
##
Expand Down

0 comments on commit d2691ee

Please sign in to comment.