title: Helm Charts - How do I use `default` on undefined object property values?
body: <p>Using Helm, I was under the impression <code>default</code> would be the fallback if a variable is not defined. However, it doesn't appear Helm can get to values in sub-object hashes:</p>
  
  <pre><code>  type: {{ default "NodePort" .Values.fpm.service.type }}
  </code></pre>
  
  <p>If <code>.Values.fpm.service</code> or <code>service.type</code> is not defined, it should use 9000.</p>
  
  <p>However, attempting to template this throws a nil pointer error:</p>
  
  <pre><code> &lt;.Values.fpm.service.type&gt;: nil pointer evaluating interface {}.type
  </code></pre>
  
  <p>Is there a way to simply perform this level of variable testing? Or am I subjected to an if/else test?</p>
  
  <p>The intent of this is to <em>optionally</em> define <code>.fpm.service</code> (and <code>[..].type</code>) within your <code>values.yaml</code> file.</p>
  
  <p>(I'm building a Helm Library chart to handle optional definitions by main charts)</p>