I was trying to implement the Helm Kubernetes deployment using helm chart. I would to give the deployment,app and service name using the helm release name dynamically.
I have implemented the below approach which help me to create the dynamic name based upon the helm file.
Written the below method inside the _helper.tpl
{{- define "sample-chart-getServiceName" -}}
{{- $arg1 := index . "arg1" -}}
{{- $fullName := include "sample-chart.fullname" . -}}
{{- printf "%s-%s" $fullName $arg1 -}}
{{- end -}}
and below ways to calling the function inside the yaml file
name: {{ include "sample-chart-getServiceName" (dict "arg1" "service") }}