<p>I want to know if it's possible to use a value as an object key of a different value like this?</p>

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

<p>When my <code>values.yaml</code> is like:</p>

<pre><code>production:
  replicas: 2
staging:
  replicas: 1
</code></pre>

<p>And I install like this:</p>

<pre><code>helm install --namespace production my-release .
</code></pre>

<p>If not, is there any other way to achieve this?</p>

Moshe
<p>You can use more than one value file when installing a helm chart. You can have a "default" values.yaml, and then have several values.env.yaml files with the specific settings for each environment. </p>

<p>So you would have:</p>

<p>values.yaml</p>

<pre><code>someConfigForAllEnvironments: true
</code></pre>

<p>values.staging.yaml</p>

<pre><code>replicas: 1
</code></pre>

<p>values.production.yaml</p>

<pre><code>replicas: 2
</code></pre>

<p>template.yaml</p>

<pre><code>...
spec:
  replicas: {{ .Values.replicas }}
...
</code></pre>

<p>And you would install with:</p>

<pre><code>helm install --namespace production my-release -f values.production.yaml
</code></pre>
