Helm Dependent charts
helm charts can contain multiple charts to form an app. A web application helm chart can contain a webapp chart and a database chart. The database chart can be considered as the dependent helm chart of the web app helm chart. Dependent charts can be added as dependencies in the Chart.yaml file in a helm chart. The content of the charts/ subdirectory is the one and only source of truth on dependencies to be installed or upgraded. It expects instead a chart to embed all dependencies it needs, recursively. This decision was probably taken because the chart metadata is really small, especially when compressed. and the chart transitive dependency graphs are not large, so embedding the whole graph in an archive is feasible, which would not be in Maven's case. Indeed, for a situation where an "a" chart depends on a "b" chart, and the "b" chart depends on a "c" chart, the structure of the "a"'s chart archive is;
a
├── Chart.yaml
├── charts
│ └── b
│ ├── Chart.yaml
│ ├── charts
│ │ └── c
│ │ ├── Chart.yaml
│ │ ├── templates
│ │ │ └── pod.yaml
│ │ └── values.yaml
│ ├── templates
│ │ └── pod.yaml
│ └── values.yaml
├── templates
│ └── pod.yaml
└── values.yaml
dependencies:
- name: redis
version: 12.7.x
repository: https://charts.bitnami.com/bitnami
condition: cache.enabled
- name: b
version: 1.0.0
repository: file://../b
condition: sql.enabled
The parent helm chart adds redis chart form bitnami as the dependent chart. The key condition: cache.enabled has been set as a requirement in the parent chart to include the redis child chart. It is futher enforced in values.yaml file by adding the key. Changing the setting in the values.yaml file help us to control deployment
When downloading a dependency for the first time, you should use the helm dependency update command. This command will download your dependency to the charts/ directory and will generate the Chart.lock file, which specifies metadata about the chart that was downloaded.
values can be added to the redis chart using values.yaml file.
Reference links