Helm: Dependency management

helm dependencies

2 min read | by Jordi Prats

We can define dependencies you our helm charts using the dependencies key on the Chart.yaml file:

(...)
dependencies:
- name: gatekeeper
  version: "3.9.0"
  repository: "https://open-policy-agent.github.io/gatekeeper/charts"

If we try to install this helm chart we'll get an error when the dependencies are not downloaded yet:

$ helm install example -n demons example
Error: INSTALLATION FAILED: An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: gatekeeper

To be able to download dependencies we'll need to add the repositories:

helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts

To finally fetch the helm charts:

$ helm dependency build example/
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "gatekeeper" chart repository
Update Complete. Happy Helming!
Saving 1 charts
Downloading gatekeeper from repo https://open-policy-agent.github.io/gatekeeper/charts
Deleting outdated charts

The downloaded packages will be stored on the charts directory:

$ ls example/charts/
gatekeeper-3.9.0.tgz

It will create (or update) the Chart.lock file with the digest hash:

dependencies:
- name: gatekeeper
  repository: https://open-policy-agent.github.io/gatekeeper/charts
  version: 3.9.0
digest: sha256:9f4bc6703e2d17986a956c3ba28a4514e8f881421c2304a262223575598e53a3
generated: "2022-09-30T19:41:47.706214+02:00"

Posted on 03/10/2022

Categories