Skip to content
docktionary

Snippets / Helm

Helm chart dependency

Pulling in a public chart (Postgres, here) as a dependency of your own, toggled by a values.yaml flag.

helmchart.yamldependencysubchart
Chart.yaml
apiVersion: v2
name: my-app
description: My application, with a bundled Postgres dependency
type: application
version: 0.1.0
appVersion: "1.0.0"

dependencies:
  - name: postgresql
    version: "15.x"
    repository: https://charts.bitnami.com/bitnami
    # Only pulled in -- and only installed -- when the parent chart's
    # own values.yaml sets postgresql.enabled: true. Without a
    # condition, the dependency always installs, which is wrong for
    # anyone pointing the chart at an external database instead.
    condition: postgresql.enabled