Are helm subcharts dependent on parent charts when using global variables?

1/29/2019

In the documentation for helm subcharts and globals, they list 4 details of which 2 I want to focus on

  1. A subchart is considered "stand-alone", which means a subchart can never explicitly depend on its parent chart.
  2. For that reason, a subchart cannot access the values of its parent.
  3. A parent chart can override values for subcharts.
  4. Helm has a concept of global values that can be accessed by all charts.

From the examples it seems like 1 and 4 are contradictory. If I create a global variable in the parent chart and then reference this in the sub chart, would this not create a dependency between the parent and sub charts?

-- Ryan-Neal Mes
kubernetes-helm

1 Answer

4/11/2019

The sub chart will still be considered "stand-alone". Using global values will create a dependency on the values.yaml of your parent chart (not an explicit dependency on the parent chart itself).

To overcome this, you must explicitly pass the parent values (via --values flag) when installing individual sub-charts. e.g.:

Supposing the following structure:

$ tree parent/
parent/
├── charts
│   └── child
│       ├── Chart.yaml
│       └── templates
│           └── configmap.yaml
├── Chart.yaml
└── values.yaml

To install the child subchart individually, you must use:

helm install ./parent/charts/child/ --values ./parent/values.yaml

There is an open discussion (#4767) in helm project to improve this.

-- Eduardo Baitello
Source: StackOverflow