I have a values.yaml that looks like this, and I want to select the first url
ingress:
hosts:
- host: url
paths:
- /
- host: url2
paths:
- /
Here is what I have currently tried:
{{ first .Values.ingress.hosts.host }}
But I'm getting error: can't evaluate field host in type interface {}
Could anyone help me format the selection properly to just select the first url?
.Values.ingress.hosts
is a list, so you have to select the first
item from that, and then you can select the host
out of it:
{{ (first .Values.ingress.hosts).host }}
You could also use the Go text/template index
function to do the traversal (where index 0 is "the first item")
{{ index .Values.ingress.hosts 0 "host" }}