I am trying to make another helper function which uses an existing helper function but that seems to be not working.
I have following function in _helpers.tpl file:
{{- define "redis.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 30 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 30 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
Now I am trying to add another function to build connection string for redis using above function:
{{ - define "redis.connection_string" -}}
{{ - printf "redis://%s:%s/" include "redis.fullname" .Value.port -}} # This line is important. Can we use above function like this?
{{ -end -}}
And this is final content of my _helpers.tpl file:
{{- define "redis.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 30 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 30 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{ - define "redis.connection_string" -}}
{{ - printf "redis://%s:%s/" include "redis.fullname" .Value.port -}}
{{ - end -}}
GO and Helm both are new to me so not able to figure out correct synatx and even if its possible. (Is this how we write 2 functions in same helper file?) Can anyone please help here.