Skip to content

Commit

Permalink
Fix: Fix How DNS policy and Config is injected into pod
Browse files Browse the repository at this point in the history
Of course, the issue was YAML indending and spacing.
  • Loading branch information
bokysan committed Oct 27, 2023
1 parent 2d21a4f commit 12607b8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
24 changes: 2 additions & 22 deletions helm/mail/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,30 +177,10 @@ spec:
{{- tpl .Values.extraContainers $root | nindent 8 }}
{{- end }}
{{- if .Values.dns.policy }}
dnsPolicy: {{- .Values.dns.policy }}
dnsPolicy: {{ .Values.dns.policy | quote }}
{{- end }}
{{- if or .Values.dns.nameservers .Values.dns.searches .Values.dns.options }}
dnsConfig:
{{- if .Values.dns.nameservers }}
nameservers:
{{- range .Values.dns.nameservers }}
- {{ . }}
{{- end }}
{{- end }}
{{- if .Values.dns.searches }}
searches: {{- .Values.dns.searches | nindent 4 }}
{{- end }}
{{- if .Values.dns.options }}
options:
{{- range .Values.dns.options }}
{{- if .name }}
- name: {{ .name }}
{{- if .value }}
value: {{ .value | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
dnsConfig: {{- toYaml (omit .Values.dns "policy") | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.certs.create }}
Expand Down
10 changes: 5 additions & 5 deletions helm/test_14_test_dns_policy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dns:
policy: "None"
nameservers:
- 8.8.8.8
- 8.8.4.4
- "8.8.8.8"
- "8.8.4.4"
searches: "default.svc.cluster.local svc.cluster.local cluster.local"
options:
ndots:
- name: ndots
value: "5"
- name: ndots
value: "5"
- name: edns0
17 changes: 15 additions & 2 deletions helm/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if command -v gfind >/dev/null 2>&2; then
FIND="$(which gfind)"
fi

for i in `${FIND} -maxdepth 1 -type f -name test\*yml | sort`; do
do_the_test() {
local i="${1}"
echo "☆☆☆☆☆☆☆☆☆☆ $i ☆☆☆☆☆☆☆☆☆☆"
helm template -f $i --dry-run mail > fixtures/demo.yaml
docker run \
Expand All @@ -21,4 +22,16 @@ for i in `${FIND} -maxdepth 1 -type f -name test\*yml | sort`; do
--force-color \
--additional-schema-locations file:///schemas \
fixtures/demo.yaml
done
}


if [[ $# -gt 0 ]]; then
while [[ $# -gt 0 ]]; do
do_the_test "${1}"
shift
done
else
for i in `${FIND} -maxdepth 1 -type f -name test\*yml | sort`; do
do_the_test "${i}"
done
fi

0 comments on commit 12607b8

Please sign in to comment.