<p>Is there a way to pass multiple variables in <code>template</code> or a function using <code>include</code>? In my case I iterate over a list of items, but in the template I also need the <code>.Release.Name</code> variable.</p>

<p>Is there a way to add to <code>$client</code> the <code>.Release.Name</code>? I tried something like <code>{{ $client.Name := .Release.Name }}</code>, but it throws an error..</p>

<p>I have the following template:</p>

<pre><code>{{- range $client := .Values.global.clients }}
{{- with $ }}
search.service-{{ $client.clientId }}.cfg: |
{{ include "rest-api.search" $client | indent 4}}
{{- end}}
{{- end}}
</code></pre>

<p>The rest-api.search function:</p>

<pre><code>{{- define "rest-api.search" -}}
client.id={{ .clientId }}
id={{ .clientId }}
uri=http://{{ .Release.Name }}:11666/{index}/ws/{configuration}
default.index=quicksearch
default.configuration=form
query.sort=
query.filter=
query.dsf=word
query.lower=0
query.max=10
query.locale=de
query.query=*
# Index mapping
index.COMMON=quicksearch
index.REF=quicksearch
supportObjectGroup=true
# authorization scheme
authScheme=NONE

{{- end -}}
</code></pre>

<p>I appreciate your help. Thanks</p>

<p>You can pass client object alongside release object in a dict</p>

<p><strong>values.yaml</strong></p>

<pre><code>global:
  clients:
    - name: test
      clientId: test-123
</code></pre>

<p><strong>configmap.yaml</strong></p>

<pre><code>{{- range $client := .Values.global.clients }}
{{$data := dict "client" $client "release" $.Release }}
search.service-{{ .clientId }}.cfg: |
{{ include "mychart.search" $data | indent 4}}
{{- end}}
</code></pre>

<p><strong>_helpers.tpl</strong></p>

<pre><code>{{- define "mychart.search" -}}
client.id={{ .client.clientId }}
id={{ .client.clientId }}
uri=http://{{ .release.Name }}:11666/{index}/ws/{configuration}
default.index=quicksearch
{{- end -}}
</code></pre>
