Fix: Fix How DNS policy and Config is injected into pod

Of course, the issue was YAML indending and spacing.
This commit is contained in:
Bojan Čekrlić 2023-10-27 10:49:00 +02:00
parent 2d21a4f908
commit 12607b8b68
3 changed files with 22 additions and 29 deletions

View file

@ -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 }}

View file

@ -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

View file

@ -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 \
@ -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