Overriding Library Defaults Locally
Customizing shared templates per consumer.
Overriding Library Defaults Locally is a free Helm Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Helm Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Shared, But Not Rigid
A good library sets sensible defaults yet lets each consumer adjust them. The main lever is the values the partial reads at render time.
Drive Behavior Through Values
Because partials read .Values, your chart customizes shared output simply by setting those keys in its own values.yaml.
# your values.yaml
image:
repository: nginx
tag: "1.27"Libraries Lean on default
Well-written partials wrap reads in the default function, so an unset value falls back gracefully instead of rendering empty.
replicas: {{ .Values.replicaCount | default 1 }}Override Just That Key
To change one default, set only that key in your values. The library keeps every other fallback, so you override the minimum needed.
# your values.yaml
replicaCount: 3Override a Whole Partial
Need bigger changes? Redefine the named template in your own chart. The last define for a name wins, so your version replaces the library's.
{{- define "common.labels" -}}
team: payments
{{- end -}}Last Definition Wins
When two charts define the same template name, Helm uses the one loaded last. Your application chart can deliberately shadow a library partial.
Wrap Rather Than Replace
Often cleaner: define a new partial that includes the library one, then appends your extra fields. You extend without losing upstream logic.
{{- define "app.labels" -}}
{{ include "common.labels" . }}
tier: backend
{{- end -}}Pass a Custom Scope
Instead of the root dot, hand a partial a narrowed context so it reads from a subtree of your values, reshaping its output per call.
{{ include "common.resources" .Values.web }}Build a Merged Context
For finer control, construct a dict mixing the root and overrides, then pass it in. The partial sees exactly the values you assembled.
{{ include "common.tpl" (dict "top" . "name" "web") }}Confirm the Override Took
Always run helm template after overriding to verify your values or redefined partial produced the manifest you intended.
helm template my-release . | grep replicasKeep Overrides Minimal
Lean on values first and redefine partials only when necessary. Small, local overrides keep your chart aligned with library upgrades.
Quick Check
Your chart and its library both define common.labels. Which definition does Helm actually use?
Recap: Local Overrides
Customize a library through values first, redefine or wrap partials when needed, pass custom scope, then verify with helm template. ✅
Frequently asked questions
Is the “Overriding Library Defaults Locally” lesson free?
Yes — the full text of “Overriding Library Defaults Locally” is free to read here on the web, and the Helm Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Helm Academy course, upgrade to CoddyKit PRO.
What will I learn in “Overriding Library Defaults Locally”?
Customizing shared templates per consumer. You practise Helm Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Helm Academy?
No prior experience is required. Helm Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Overriding Library Defaults Locally” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Helm Academy lesson?
Yes. Every Helm Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Declaring a Library Chart Type
- Exporting Reusable Named Templates
- Consuming a Library as a Dependency
- Overriding Library Defaults Locally