title: How to fix `can't evaluate field extraHosts in type interface {}` in _helpers.tpl in helm
body: <p>I am trying to get some values from Umbrella chart in helm in <code>_helpers.tpl</code> but I for some reason I am getting the error <code>executing "gluu.ldaplist" at &lt;.Values.ldap.extraHo...&gt;: can't evaluate field extraHosts in type interface {}</code></p>
  
  <p>This is what I am trying to do.
  <code>_helpers.ptl</code></p>
  
  <pre><code>{{- define "gluu.ldaplist" -}}
  {{- $hosts := .Values.ldap.extraHosts -}}
  {{- $genLdap := dict "host" (printf "%s-%s" .Release.Name .Values.ldapType) "port" .Values.ldapPort -}}
  {{- $hosts := prepend $hosts $genLdap -}}
  {{- $local := dict "first" true -}}
  {{- range $k, $v := $hosts -}}
  {{- if not $local.first -}},{{- end -}}{{- printf "%s:%.f" $v.host $v.port -}}{{- $_ := set $local "first" false -}}
  {{- end -}}
  {{- end -}}
  </code></pre>
  
  <p>And this is part of <code>values.yml</code> for the umbrella chart
  <code>values.yml</code></p>
  
  <pre><code>ldap:
    enabled: true
    type: opendj
    extraHosts: [
      host: opendj,
      port: 3434
    ] #array of k,v e.g host: host1, port: port1
  </code></pre>
  
  <p>Directory structure</p>
  
  <pre><code>helm/
    charts/
       chart_a/
         templates/
            configMap.yml -----&gt;&gt;&gt; this is where I want to use it
    templates/
       _helpers.tpl ----&gt;&gt;&gt;&gt; where the failing function is
    requirements.yml
    values.yml ----------&gt;&gt;&gt; where the ldap values are
  
  </code></pre>
  
  <p>The <code>configMap.yml</code> looks like below</p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: {{ template "oxauth.fullname" . }}-cm
  data:
    GLUU_CONFIG_ADAPTER: {{ .Values.global.configAdapterName | quote }}
    GLUU_LDAP_URL: {{ template "gluu.ldaplist" . }}
  </code></pre>
  
  <p>NOTE: The <code>_helpers.tpl</code> is under the main/umbrella chart. <code>chart_a</code> is a subchart.</p>
  
  <p>Expected results are something like <code>GLUU_LDAP_URL:"opendj:3434"</code></p>
  
  <p>Helm version:  </p>
  
  <pre><code>Client: &amp;version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
  Server: &amp;version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
  </code></pre>
  
  <p>Expected result is that the function <code>{{- define "gluu.ldaplist" -}}</code> in <code>_helpers.tpl</code> completes without error even if no values are provided in the array. 
  If there are values provided, the expected string is <code>host:port</code> as output.</p>
  
  <p>If this can be done in another way, I welcome any suggestion.</p>