k8s/helm-charts/dashy/charts/common/templates/lib/pod/_hostAliases.tpl
root 1eaf295724
Some checks failed
continuous-integration/drone/push Build is failing
new way of doin
2023-11-16 19:42:02 +10:00

38 lines
1.0 KiB
Smarty

{{/* Returns Host Aliases */}}
{{/* Call this template:
{{ include "tc.v1.common.lib.pod.hostAliases" (dict "rootCtx" $ "objectData" $objectData) }}
rootCtx: The root context of the chart.
objectData: The object data to be used to render the Pod.
*/}}
{{- define "tc.v1.common.lib.pod.hostAliases" -}}
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData -}}
{{- $aliases := list -}}
{{/* Initialize from the "global" option */}}
{{- with $rootCtx.Values.podOptions.hostAliases -}}
{{- $aliases = . -}}
{{- end -}}
{{/* Override with pod's option */}}
{{- with $objectData.podSpec.hostAliases -}}
{{- $aliases = . -}}
{{- end -}}
{{- range $aliases -}}
{{- if not .ip -}}
{{- fail (printf "Expected non-empty <ip> value on <hostAliases>.") -}}
{{- end -}}
{{- if not .hostnames -}}
{{- fail (printf "Expected non-empty <hostames> list on <hostAliases>.") -}}
{{- end }}
- ip: {{ tpl .ip $rootCtx }}
hostnames:
{{- range .hostnames }}
- {{ tpl . $rootCtx }}
{{- end -}}
{{- end -}}
{{- end -}}