helm-charts/charts/library/common/templates/lib/pod/fields/_dnsPolicy.tpl
2023-09-13 11:24:23 +02:00

25 lines
683 B
Smarty

{{- /*
Returns the value for dnsPolicy
*/ -}}
{{- define "bjw-s.common.lib.pod.field.dnsPolicy" -}}
{{- $ctx := .ctx -}}
{{- $controllerObject := $ctx.controllerObject -}}
{{- /* Default to "ClusterFirst" */ -}}
{{- $dnsPolicy := "ClusterFirst" -}}
{{- /* Get hostNetwork value "" */ -}}
{{- $hostNetwork:= get $controllerObject.pod "hostNetwork" -}}
{{- if $hostNetwork -}}
{{- $dnsPolicy = "ClusterFirstWithHostNet" -}}
{{- end -}}
{{- /* See if an override is desired */ -}}
{{- $override := get $controllerObject.pod "dnsPolicy" -}}
{{- if not (empty $override) -}}
{{- $dnsPolicy = $override -}}
{{- end -}}
{{- $dnsPolicy -}}
{{- end -}}