title: Helm optional nested variables
body: <p>How do I make an optional block in the values file and then refer to it in the template? </p>
  
  <p>For examples, say I have a values file that looks like the following: </p>
  
  <pre><code># values.yaml
  foo:
     bar: "something"
  </code></pre>
  
  <p>And then I have a helm template that looks like this:</p>
  
  <pre><code>{{ .Values.foo.bar }}
  </code></pre>
  
  <p>What if I want to make the foo.bar in the values file optional? An error is raised if the <code>foo</code> key does not exist in the values. </p>
  
  <p>I've tried adding as an if conditional. However, this still fails if the <code>foo</code> key is missing:</p>
  
  <pre><code>{{ if .Values.foo.bar }}
  {{ .Values.foo.bar }}
  {{ end }}
  </code></pre>
  
  <p>Any thoughts are much appreciated.</p>