Consuming a Library as a Dependency
Wiring the library into an application chart.
Consuming a Library as a Dependency is a free Helm Academy lesson on CoddyKit — lesson 3 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.
Wire the Library In as a Dependency
An application chart pulls in a library by listing it under dependencies in Chart.yaml, just like any other subchart.
# Chart.yaml
dependencies:
- name: common
version: 1.x.x
repository: file://../commonPoint at a Local or Remote Source
The repository can be a file path during development or an HTTP or OCI URL in production. Both bring the library's templates into your chart.
repository: https://charts.bitnami.com/bitnami
# or file://../commonVendor It With dependency update
Run helm dependency update to fetch the library into your charts directory and lock its version in Chart.lock.
helm dependency update .
# downloads common into charts/Templates Merge Into One Namespace
Once vendored, the library's named templates join your chart's global template namespace. You can call them as if you had written them.
Call a Partial With include
Use include to render a library template into your own manifest. It returns text you can pipe to other functions.
metadata:
name: {{ include "common.fullname" . }}Always Pass the Context
The dot after the template name is the scope you hand to the partial. Pass the root context so it can read .Values and .Release.
{{ include "common.labels" . | nindent 4 }}Prefer include Over template
Unlike template, include returns a string, so you can pipe its result into indent or nindent for correct YAML placement.
labels:
{{- include "common.labels" . | nindent 2 }}Library Brings No Manifests
Adding a library dependency adds zero resources by itself. Your own templates decide what to render by calling the library's partials.
Render an Entire Resource
If the library defines a whole object, your template file can be a single include line that emits the complete Service or Deployment.
# templates/service.yaml
{{ include "common.service" . }}Verify With helm template
Run helm template on your app chart to confirm the library's partials resolved and produced the YAML you expected.
helm template my-release .Pin the Library Version
Lock the dependency to a known version range so a library change never silently alters your rendered manifests in CI.
dependencies:
- name: common
version: 2.4.0Quick Check
You call a library partial and want to pipe its result through nindent. Which directive should you use?
Recap: Consuming a Library
List the library under dependencies, run helm dependency update, then call its partials with include and pass the context. 🔗
Frequently asked questions
Is the “Consuming a Library as a Dependency” lesson free?
Yes — the full text of “Consuming a Library as a Dependency” 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 “Consuming a Library as a Dependency”?
Wiring the library into an application chart. 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 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Consuming a Library as a Dependency” 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