I'm using helm 2.16. I have a chart with this structure:
umbrella
|-charts
|-subchart1
|-subchart2
I want to be able to install umbrella chart + subchart1 or umbrella chart + subchart2 by using a single flag (subchart1 or subchart2) and have a default for that flag as subchart1.
As helm chart conditions on requirements cannot be negated, are there any other solutions available other that guarding all the resources from one of the charts with IFs ?
A workaround that I have found is to place all the subcharts into a subchart folder and have the requirements.yaml
configuration file similar to below:
dependencies:
- name: subchart1
version: example-version
repository: "subchart1-directory"
alias: postgresql
condition: subchart1.enabled
- name: subchart2
version: example-version
repository: "file://subcharts/subchart2"
condition: subchart2.enabled
and in values.yaml
, add
subchart1:
enabled: true
subchart2:
enabled: false
Then during installation, pass the values to enabled or disable the subchart1 as follows:
$ helm install --set subchart1.enabled=true
or
$ helm install --set subchart1.enabled=false
Take a look here: helm-charts-management, helm-chart-dependences.