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

ConstraintMatches
1.2.3Exact
^1.2.0>=1.2.0 <2.0.0
~1.2.0>=1.2.0 <1.3.0
>=1.0 <2Range

3. Setting Dependency Repository

Repository formExample
HTTPhttps://charts.bitnami.com/bitnami
OCIoci://ghcr.io/acme/charts
Alias@bitnami (must match local repo alias)
Filefile://../mychart

4. Using Local Dependencies

Example: Sibling chart

dependencies:
  - name: shared-lib
    version: "1.0.0"
    repository: "file://../shared-lib"

5. Enabling Conditional Dependencies

MechanismValue
condition: postgresql.enabledSingle value path; enabled if truthy
condition: a.enabled,b.enabledFirst 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

CommandEffect
helm dependency updateRe-resolve and download into charts/
helm dependency buildInstall 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

CommandOutput
helm dependency list ./chartName, version, repo, status
status okDependency present in charts/
status missingNeed 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

FieldPurpose
dependenciesPinned resolved versions + digests
digestSHA of dependencies block
generatedTimestamp
Note: Commit Chart.lock for reproducible builds. helm dependency build respects it; update regenerates it.