Templates are now sharable across parent and child charts.
Refer this - https://github.com/kubernetes/helm/blob/master/docs/chart_template_guide/subcharts_and_globals.md#sharing-templates-with-subcharts
Problem that I see will be:
If your redis.fullname
template uses a variable (eg: .Values.commonVariable) that has the same name in both the charts but with different value, then, while referencing it in the parent chart, the value that will be used will be of the parent chart and not the child's.
Consider this:
{{- define "zookeeper.fullname" -}}
{{- printf "%s-%s" (.Values.component) (.Values.subcomponent) -}}
{{- end -}}
Although I want my zookeeper.fullname
to be referenced in a kafka
(parent) chart. But the .Values.component
and .Values.subcomponent
will be used of kafka and not that for zookeeper (the subchart) in the case, which totally destroys the idea.
The way out in this specific case will be to use Jainish Shah's answer. But if this is not the case, please don't follow that answer. That destroys the idea of templating. If in any way you ought to change the template function in the subchart, you will also need to modify the value {{ .Release.Name }}-redis
in your parent chart. This is not templating.
Link for the aforementioned issue - https://github.com/kubernetes/helm/issues/4314