<p>I can not find a way to iterate over a range in helm templating.
I have the next definition in my values.yaml:</p>
<pre><code>ingress:
  app1:
    port: 80
    hosts:
      - example.com
  app2:
    port: 80
    hosts:
      - demo.example.com
      - test.example.com
      - stage.example.com
  app3:
    port: 80
    hosts:
      - app3.example.com
</code></pre>
<p>And i want to generate the same nginx ingress rule for each mentioned host with:</p>
<pre><code>spec:
  rules:
  {{- range $key, $value := .Values.global.ingress }}
  - host: {{ $value.hosts }}
    http:
      paths:
      - path: /qapi
        backend:
          serviceName: api-server
          servicePort: 80
  {{- end }}
</code></pre>
<p>But it generates wrong hosts:</p>
<pre><code>- host: [example.com]
- host: [test.example.com demo.example.com test.example.com]
</code></pre>
<p>Thanks for the help!</p>

<p>I've finally got it working using:</p>

<pre><code>spec:
  rules:
  {{- range $key, $value := .Values.global.ingress }}
  {{- range $value.hosts }}
  - host: {{ . }}
    http:
      paths:
      - path: /qapi
        backend:
          serviceName: api-server
          servicePort: 80
  {{- end }}
  {{- end }}
</code></pre>
