<p>I would like to pass array as property in yaml (values file) in Helm. What I tried:</p>

<ol>
<li><p>Attempt.</p>

<pre><code>elasticsearch:
  uri: "[\"127.0.0.1:9200\",\"127.0.0.2:9200\"]"
</code></pre>

<p>Error:</p>

<blockquote>
  <p>ReadString: expects " or n, but found [, error found in #10 byte of
  ...|RCH_URL":["127.0.0.1|..., bigger context
  ...|{"apiVersion":"v1","data":{"ELASTIC_SEARCH_URL": ["127.0.0.1:9200","127.0.0.2:9200"],"LOGS_ENV_PREFI|...</p>
</blockquote></li>
<li><p>Attempt. According to <a href="https://github.com/helm/helm/issues/1987" rel="noreferrer">official helm site</a> how to pass array</p>

<pre><code>elasticsearch:
  --set uri={127.0.0.1:9200,127.0.0.2:9200}
</code></pre>

<p>With error:</p>

<blockquote>
  <p>error converting YAML to JSON: yaml: line 15: mapping values are not
  allowed in this context</p>
</blockquote></li>
<li><p>Attempt.</p>

<pre><code> elasticsearch:
   uri: 
   - 127.0.0.1:9200
   - 127.0.0.2:9200
</code></pre>

<p>Failed with the same exception as 1.</p></li>
</ol>

<p>EDIT:
Actually in my case the helm values were not used in YAML file then, so I needed another format and finally solution was to pass uri as string with single quote: </p>

<pre><code> elasticsearch:
   uri: '["127.0.0.1:9200","127.0.0.2:9200"]'
</code></pre>

<p>Nevertheless @Marcin answer was correct.</p>

Bartek
<p>You pass an array of values by using either the old fashioned json way:  </p>

<pre><code>elasticsearch:
  uri: ["127.0.0.1:9200", "127.0.0.2:9200"]
</code></pre>

<p>or the way introduced by yaml:</p>

<pre><code>elasticsearch:
  uri: 
  - 127.0.0.1:9200
  - 127.0.0.2:9200
</code></pre>

<p>You can then access the values in Helm templates using <code>range</code>:</p>

<pre><code>Uris:{{- range .Values.elasticsearch.uri }}
{{.}}{{- end }}
</code></pre>

<p>resolves to:</p>

<pre><code>Uris:
127.0.0.1:9200
127.0.0.2:9200
</code></pre>
