what does index .Values() mean in helm?

Viewed 1368

what does index .Values (printf "%sHost" .Chart.Name) return?

Below is snippet of code from a .tpl file

{{- define "mediawiki.host" -}}

{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}}

{{- default (include "mediawiki.serviceIP" .) $host -}}

{{- end -}}

1 Answers

About index function from go template docs

index

Returns the result of indexing its first argument by the following arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each indexed item must be a map, slice, or array.

If a chart name is "mediawiki" (it is by default) then the function returns value of the .Values.mediawikiHost key

.Chart.Name == "mediawiki"
printf "%sHost" .Chart.Name == "mediawikiHost"
index .Values "mediawikiHost" == ""
Related