<p>I understand that <code>{{.Release.namespace}}</code> will render the namespace where the application being installed by <code>helm</code>. In that case, <code>helm template</code> command will render it as empty string (since it doesn't know yet the release namespace). </p>

<p>However, what makes me surprise is <code>helm upgrade --install</code> command (i haven't tried other command such as <code>helm install</code>) also renders it empty on some cases. </p>

<p>Here is the example of my helm chart template:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: {{.Values.app.name}}-{{.Values.app.track}}-internal
  namespace: {{.Release.namespace}}
  annotations:
    testAnnotate: "{{.Release.namespace}}"
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  selector:
    app: {{.Values.app.name}}
    environment: {{.Values.app.env}}
    track: {{.Values.app.track}}
  type: ClusterIP
</code></pre>

<p>After invoke <code>helm upgrade --install</code> on that chart template (and installed it successfully), I then try to see the output of my resource </p>

<pre><code>&gt; kubectl get -o yaml svc java-maven-app-stable-internal -n data-devops
apiVersion: v1
kind: Service
metadata:
  annotations:
    testAnnotate: ""
  creationTimestamp: 2018-08-09T06:56:41Z
  name: java-maven-app-stable-internal
  namespace: data-devops
  resourceVersion: "62906341"
  selfLink: /api/v1/namespaces/data-devops/services/java-maven-app-stable-internal
  uid: 5e888e6a-9ba1-11e8-912b-42010a9400fa
spec:
  clusterIP: 10.32.76.208
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app: java-maven-app
    environment: stg
    track: stable
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
</code></pre>

<p>As you can see, I put <code>{{.Release.namespace}}</code> on 2 places:</p>

<ul>
<li>in <code>metadata.namespace</code> field</li>
<li>in <code>metadata.annotations.testAnnotate</code> field.</li>
</ul>

<p>But it only renders the correct namespace on <code>metadata.namespace</code> field. Any idea why?</p>

Agung Pratama
<p>The generated value <code>.Release.Namespace</code> is case-sensitive. The letter N in "namespace" should be capitalized.</p>
