<p>values.yaml</p>

<pre><code>replicas: {
  test: 1,
  stage: 2,
  prod: 3
}
</code></pre>

<p>Here I am trying to use Helm templates to define number of replicas per namespace but am unsure of the proper syntax and pattern:</p>

<p>deployment.yaml</p>

<pre><code>replicas: {{ .Values.replicas.{{ .Release.Namespace }} }}
</code></pre>

<p>So if this were deployed to <code>--namespace=prod</code>, I would expect the template to return:</p>

<pre><code># .Values.replicas.prod
replicas: 3
</code></pre>

<p>All of the template functions provided by the standard Go <a href="https://godoc.org/text/template" rel="noreferrer">text/template</a> library are available.  In particular, that includes an <code>index</code> function which can do dynamic lookup in an array or map object.</p>

<pre><code>replicas: {{ index .Values.replicas .Release.Namespace }}
</code></pre>
