Interview Prep/Helm/Dependencies, Subcharts & Library Charts

How does a parent chart reference a subchart's Service name reliably?

AdvancedConceptDependencies, Subcharts & Library Charts
Answer

Options, from simplest to cleanest:

  1. Rely on the subchart's naming convention and replicate it: {{ .Release.Name }}-postgres. Breaks if the user sets postgres.fullnameOverride.
  2. Read the override in the parent: {{ .Values.postgres.fullnameOverride | default (printf "%s-postgres" .Release.Name) }}.
  3. Call the subchart's own helper with a constructed context (works on any Helm 3 version; recent versions also expose the subchart scope as .Subcharts.postgres):
{{- $pgCtx := dict "Values" .Values.postgres "Release" .Release "Chart" (dict "Name" "postgres") }}
host: {{ include "shop-postgres.fullname" $pgCtx }}

Document the chosen approach in values.yaml so overrides stay consistent.

All Helm questions Roadmap: Helm

More on Dependencies, Subcharts & Library Charts