How to set helm chart dependency parameters

12/3/2019

I'm creating a helm chart that's dependent on the stable/postgres chart. I'm using helm version 2.14.

While specifying this dependency in the requirements.yaml file, I'd like to set some of the parameters such as persistence.size which are usually passed using helm install --set.

I tried to follow the instructions in this post: Set value in dependency of Helm chart

I added this at the end of my values.yaml:

postgresql:
  replication:
    enabled: true
    slaveReplicas: 2
  persistence:
    size: 2Gi

But unfortunately after helm dep update, I inspected the downloaded chart and the values in values.yaml were not overwritten.

What could be missing here or what are my alternatives? Thank you.

-- StrayPointer
kubernetes-helm
postgresql

1 Answer

12/3/2019

A parent chart can not overwrite values of subchart(s). Please refer to Subcharts and Global Values:

  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.

Your values.yaml in either parent chart or for your helm release will take effect when installing chart into k8s or render via helm template. However, values.yaml of a subchart will be kept as it was.

-- shawmzhu
Source: StackOverflow