Skip to content

Instantly share code, notes, and snippets.

@droopy4096
Last active June 8, 2021 19:36
Show Gist options
  • Save droopy4096/309b20baa86a9d2ed7c80588edee3753 to your computer and use it in GitHub Desktop.
Save droopy4096/309b20baa86a9d2ed7c80588edee3753 to your computer and use it in GitHub Desktop.
Helm execute a template in a subchart's scope
# idea from https://github.com/helm/helm/issues/4535#issuecomment-477778391
{{- define "call-nested" }}
{{- $dot := index . 0 }}
{{- $subchart := index . 1 | splitList "." }}
{{- $template := index . 2 }}
{{- $values := $dot.Values }}
{{- range $subchart }}
{{- $values = index $values . }}
{{- end }}
{{- include $template (dict "Chart" (dict "Name" (last $subchart)) "Values" $values "Release" $dot.Release "Capabilities" $dot.Capabilities) }}
{{- end }}
{{ include "call-nested" (list . "redis" "redis.fullname") }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment