Say I have these values
grafana:
...
ingress:
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: ["/grafana"]
This is standard helm. For this reason, I would like to keep hosts
as an array (even if it makes the following move a bit tricky). How can I get the first .host
(I do not mind about any possible other) in order to make env.value
dynamic
containers:
- name: {{ .Chart.Name }}-grafana
env:
- name: GF_DOMAIN
value: chart-example.local
I tried
env:
- name: GF_DOMAIN
{{- range .Values.grafana.ingress.hosts }}
value: {{ .host }}
{{- end }}
env:
{{- range .Values.grafana.ingress.hosts }}
- name: GF_DOMAIN
value: {{ .host }}
{{- end }}
Following this suggestion, I also tried
env:
{{- with .Values.grafana.ingress.hosts 0}}
- name: GF_DOMAIN
value: {{ .host }}
{{- end}}
or
value: {{ .Values.grafana.ingress.hosts 0 .host }}
value: {{ .Values.grafana.ingress.hosts | first.host}}
How can I handle this case?