I currently have 3 Helm repositories with the following structure:
repoA/
├── templates/
├── Chart.yaml
├── values.yaml
repoB/
├── templates/
├── Chart.yaml
├── values.yaml
masterRepo/
├── templates/
├── Chart.yaml
├── values.yaml
├── requirements.yamlThe requirements.yaml file from masterRepo is something like below:
dependencies:
- name: repoA
version: "1.0"
repository: "file://../repoA"
condition: repoA.enabled
- name: repoB
version: "1.0"
repository: "file://../repoB"
condition: repoB.enabledI would like to only use masterRepo to deploy the dependent Helm charts. I have tried the dependent charts (repoA and repoB) individually and all of them work without any issue.
I know I can manually put the three child repositories in the masterRepo/charts and it will work but I wanna keep these repositories independent so that other master-repositories can use any of them.
I am not sure what I am doing wrong but helm dependency update doesn't work for me. It simply does nothing.
Also, if I install the masterRepo using helm install release-name -f values.yaml it only installs the masterRepo/templates resources and ignores the child repository.
What to do to make the parent Helm chart detect the children and install them conditionally (based on repoX.enabled variable) without keeping the dependent repositories inside the charts directory of the Master-helm-chart?
Okay, this is pretty easy. If you have multiple Helm charts here and there in the system, you can create dependencies without changing their location.
With the structure specified in the question, we can add dependencies in requirements.yaml (Helm version: 2.x.x) or Chart.yaml (Helm version:3.x.x). I am currently using Helm v2.16.1.
Now simply run helm dependency update or helm dep up and a charts directory gets created in masterRepo. Now the updated structure of masterRepo is as follows:
masterRepo/
├── charts/
└── chartA-1.tgz
└── chartB-1.tgz
├── templates/
├── Chart.yaml
├── requirements.lock
├── requirements.yaml
├── values.yaml
The new files/directories added are:
To install the child charts conditionally, you can the following the values.yaml file of the masterRepo:
repoA:
enabled: True
repoB:
enabled: TrueNow a simple helm install command from inside the masterRepo will deploy masterRepo as well as it's dependencies (chartA and chartB).
Hope this helps. Happy Helming!