<p>I have a values.yaml that looks like this, and I want to select the first url</p>
<pre><code>ingress:
  hosts:
    - host: url
      paths:
        - /
    - host: url2
      paths:
        - /
</code></pre>
<p>Here is what I have currently tried:</p>
<p>{{ first .Values.ingress.hosts.host }}</p>
<p>But I'm getting error:
can't evaluate field host in type interface {}</p>
<p>Could anyone help me format the selection properly to just select the first url?</p>

Callum
<p><code>.Values.ingress.hosts</code> is a list, so you have to select the <code>first</code> item from that, and then you can select the <code>host</code> out of it:</p>
<pre><code>{{ (first .Values.ingress.hosts).host }}
</code></pre>
<p>You could also use the Go <a href="https://pkg.go.dev/text/template" rel="nofollow noreferrer">text/template</a> <code>index</code> function to do the traversal (where index 0 is &quot;the first item&quot;)</p>
<pre><code>{{ index .Values.ingress.hosts 0 &quot;host&quot; }}
</code></pre>
