title: helm with if condition and its scope for the value set
body: <p>I would like to overwrite the user template with <code>.Values.userTemplate</code> if it exist. But I always get <code>$user</code> as <code>undefined</code> when the <code>.Vaues.userTemplate</code> exist. If i remove <code>if</code> condition and use <code>{{- $user := tpl .Values.userTemplate . -}}</code>, it gives right value. But inside <code>if</code> codition it is not setting the value for <code>$user</code>. </p>
  
  <p>Is there anything was doing wrong? Was the scope of <code>$user</code> will be only retained inside the <code>if</code> condition? Was there a way to overwrite the <code>$user</code> if <code>.Values.userTemplate</code> exist. </p>
  
  <pre><code>    # values
      user: "default"
         # somewhere in other chart we define the  template
      userTemplate: '{{ include "username" . }}'
  
      # template
      {{- define "user" -}}
      {{- if .Values.userTemplate -}}
      {{- $user := tpl .Values.userTemplate . -}}
      {{- else -}}
      {{- $user := .Values.user -}}
      {{- end -}}
      {{- $user -}}
  
      # output of `{{ template "user" . }}` should be the value set in `{{ template "username" . }} in different chart. 
  
  Tom
  </code></pre>