<p>I am trying to update this chart  :</p>
<pre><code>k8s.v1.cni.cncf.io/networks: '[
            { &quot;name&quot; : &quot;ext&quot;, &quot;ips&quot;: {{ .Values.global.extoamlancas0 | quote }}, &quot;interface&quot;: &quot;e1&quot;},
            { &quot;name&quot; : &quot;ext-app&quot;, &quot;ips&quot;: {{ .Values.global.extapplancas0 | quote }}, &quot;interface&quot;: &quot;e3&quot;},
            { &quot;name&quot; : &quot;int-&quot;, &quot;ips&quot;: {{ .Values.global.intoamlancas0 | quote }}, &quot;interface&quot;: &quot;e2&quot;}
         ]'
Here
 if {{- if Values.a }} then I want &quot;ips&quot; to be in an array i.e 
{ &quot;name&quot; : &quot;ext-&quot;, &quot;ips&quot;: [ {{ .Values.global.extoamlancas0 | quote }} ], &quot;interface&quot;: &quot;e1&quot;}

else 
{ &quot;name&quot; : &quot;ext&quot;, &quot;ips&quot;: {{ .Values.global.extoamlancas0 | quote }}, &quot;interface&quot;: &quot;e1&quot;}
</code></pre>
<p>I want this to be done for all other 2 ips too.</p>

kavya Vaish
<p>In the values.yaml file you need to specify an array ips like this:</p>
<pre><code>ips:
  - address: 192.168.1.1
    name: no1

  - address: 192.168.1.2
    name: no2
</code></pre>
<p>And in the templates file you can loop like this:</p>
<pre><code>{{- range .Values.ips }}
  - name: {{ .name }}
    address: {{ .address }}
{{- end }}
</code></pre>
<p>Below is the snippet from golang docs: <a href="https://golang.org/pkg/text/template/#hdr-Actions" rel="nofollow noreferrer">template - Go | range</a></p>
<blockquote>
<p>{{range pipeline}} T1 {{end}}     The value of the pipeline must be an
array, slice, map, or channel.    If the value of the pipeline has
length zero, nothing is output;   otherwise, dot is set to the
successive elements of the array,     slice, or map and T1 is executed.
If the value is a map and the     keys are of basic type with a defined
order, the elements will be   visited in sorted key order.</p>
<p>{{range pipeline}} T1 {{else}} T0 {{end}}     The value of the pipeline
must be an array, slice, map, or channel.     If the value of the
pipeline has length zero, dot is unaffected and   T0 is executed;
otherwise, dot is set to the successive elements  of the array, slice,
or map and T1 is executed.</p>
</blockquote>
