title: Define a variable in Helm template
body: <p>I need to define a variable based on an <code>if</code> statement and use that variable multiple times.
  In order not to repeat the <code>if</code> I tried something like this:</p>
  
  <pre><code>{{ if condition}}
      {{ $my_val = "http" }}
  {{ else }}
      {{ $my_val = "https" }}
  {{ end }}
  {{ $my_val }}://google.com
  </code></pre>
  
  <p>However this returns an error:</p>
  
  <pre><code>Error: render error in "templates/deployment.yaml":
  template: templates/deployment.yaml:30:28:
  executing "templates/deployment.yaml" at
  &lt;include (print $.Template.BasePath "/config.yaml") .&gt;: error calling
  include: template: templates/config.yaml:175:59:
  executing "templates/config.yaml" at &lt;"https"&gt;: undefined variable: $my_val
  </code></pre>
  
  <p>Ideas?</p>