Managing Chart Dependencies
1. Declaring Dependencies
Example: Chart.yaml dependencies block
dependencies:
- name: postgresql
version: "15.3.0"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
tags: [database]
- name: redis
version: "19.0.0"
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
alias: cache
2. Specifying Dependency Version
| Constraint | Matches |
1.2.3 | Exact |
^1.2.0 | >=1.2.0 <2.0.0 |
~1.2.0 | >=1.2.0 <1.3.0 |
>=1.0 <2 | Range |
3. Setting Dependency Repository
| Repository form | Example |
| HTTP | https://charts.bitnami.com/bitnami |
| OCI | oci://ghcr.io/acme/charts |
| Alias | @bitnami (must match local repo alias) |
| File | file://../mychart |
4. Using Local Dependencies
Example: Sibling chart
dependencies:
- name: shared-lib
version: "1.0.0"
repository: "file://../shared-lib"
5. Enabling Conditional Dependencies
| Mechanism | Value |
condition: postgresql.enabled | Single value path; enabled if truthy |
condition: a.enabled,b.enabled | First found wins (comma list) |
6. Using Tag-based Dependencies
Example: Toggle group of charts
# Chart.yaml
dependencies:
- { name: postgresql, version: "15.3.0", repository: ..., tags: [storage] }
- { name: redis, version: "19.0.0", repository: ..., tags: [storage, cache] }
# values.yaml
tags:
storage: true # enables both
cache: false
7. Downloading Dependencies
| Command | Effect |
helm dependency update | Re-resolve and download into charts/ |
helm dependency build | Install from existing Chart.lock |
8. Building Dependency Charts
Example: Reproducible CI build
helm dependency build ./chart # uses Chart.lock only
helm package ./chart
9. Listing Dependencies
| Command | Output |
helm dependency list ./chart | Name, version, repo, status |
status ok | Dependency present in charts/ |
status missing | Need helm dependency update |
10. Importing Child Values
Example: Surface subchart values at parent level
dependencies:
- name: postgresql
version: "15.3.0"
repository: https://charts.bitnami.com/bitnami
import-values:
- child: auth.username
parent: db.user
- child: primary.service
parent: db.service
11. Overriding Subchart Values
Example: Parent values.yaml
postgresql:
enabled: true
auth:
username: api
database: api_db
primary:
persistence:
size: 20Gi
12. Managing Chart.lock File
| Field | Purpose |
dependencies | Pinned resolved versions + digests |
digest | SHA of dependencies block |
generated | Timestamp |
Note: Commit Chart.lock for reproducible builds. helm dependency build respects it; update regenerates it.