<p>I am trying to iterate over a list in Helm3, in order to create several namespaces in one template file.</p>
<p>values.yaml</p>
<pre><code>namespace:
  - dev
  - vv
</code></pre>
<p>templates/namespaces.yaml</p>
<pre><code>{{- range .Values.namespace }}
---
apiVersion: v1
kind: Namespace
metadata:
  name: {{ . | quote }}
{{- end }}
</code></pre>
<p>However when I try to <code>helm install . -f values.yaml</code> I get the following error:</p>
<pre><code>Error: unable to build kubernetes objects from release manifest: error validating &quot;&quot;: error validating data: ValidationError(Secret.metadata.namespace): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.namespace: got &quot;array&quot;, expected &quot;string&quot;
</code></pre>
<p>Any ideas what i'm doing wrong?</p>

Nati Koli
<p>Actually the error does not relate to the templates/namespaces.yaml but to some other template (secret). Probably the <code>namespace</code> from the <code>values.yaml</code> overrides a value with the same name from the default <code>values.yaml</code>. Try renaming it, e.g. <code>namespaces</code>.</p>
