Consuming a Library as a Dependency
Wiring the library into an application chart.
Consuming a Library as a Dependency is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 3 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
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. 🔗
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “Consuming a Library as a Dependency” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Consuming a Library as a Dependency”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
What will I learn in “Consuming a Library as a Dependency”?
Wiring the library into an application chart. You practise DevOps Bootcamp 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 DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.
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 DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp 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