<p>Bit of a helm novice here, in short I want to reference the current Kubernetes context within my helm chart template. Is this possible? Example:</p>

<p>if the upgrade was run via:</p>

<pre><code>/var/jenkins_home/helm291 upgrade -i --kube-context Dev
</code></pre>

<p>And the template contained a deployment.yaml with the following:</p>

<pre><code>...
spec:
  containers:
    - name: {{ .Chart.Name }}
      image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
      env:
      {{- if contains "Dev" .Release.Kube_Context}}
</code></pre>

<p>Is there some variable I am missing that can check the Kube Context (aka replace Release.Kube_Context)? Am I approaching this the wrong way (specifying environment configuration)?</p>

pasquers
<p>There is no way of doing it and it's also a bad practice to do it in the templates. Templates should be generic - you modify environment specific things in values.yaml files. You can use the --kube-context flag instead if you are running it from Jenkins</p>
