This repository exists to demonstrate a flaw with Helm's recursive dependency management.
Currently, Helm will generate a set of resources for every dependency listed in the chart tree. Unfortunately, this causes breakage when the same dependency is listed multiple times.
As a workaround, one can only have dependencies listed in the umbrella and leave them out of the subcharts, but this removes the ability to develop and test the subcharts as separate entities from the umbrella.
It would make more sense for Helm to identify the overlapping dependencies and only generate a single set of resources for all the charts to use.
Imagine an application stack with two services that want to access the same database. If you place each service in its own chart and use an umbrella chart to combine them, you will end up with the following hierarchy:
umbrella
├── helpers
├── mariadb (sampledb)
├── subchart1
│ ├── helpers
│ └── mariadb (sampledb)
└── subchart2
├── helpers
└── mariadb (sampledb)
Both subchart1 and subchart2 work fine on their own. However, when they are both included with the umbrella chart, a collision occurs.
$ helm dep build subchart1
$ helm dep build subchart2
$ helm dep build umbrella
$ helm install --debug --dry-run ./umbrella |
grep Source |
sed 's!.*[ /]\([^/]*/templates/.*\.yaml\)$!\1!' |
sort |
uniq -c
3 sampledb/templates/configmap.yaml
3 sampledb/templates/deployment.yaml
3 sampledb/templates/pvc.yaml
3 sampledb/templates/secrets.yaml
3 sampledb/templates/svc.yaml
1 subchart1/templates/configmap.yaml
1 subchart2/templates/configmap.yaml
Trying to install this umbrella package will cause an error due to duplicated resources.
$ helm install --debug ./umbrella
Error: release quoting-possum failed: secrets "quoting-possum-sampledb" already exists