How to create a custom Helm chart that basically just sets values of another chart?

10/5/2018

I'm new to Helm and I haven't quite fully grasped the concepts yet. What I'm currently trying to do is to create a custom chart that basically just sets specific values for another chart that's available in the default stable repository. Pretty much what I want to do is have this:

helm install \
-f my-custom-values.yaml \
stable/target-chart \
--name=my-release

changed into

helm install my-apps/my-release

With my-release using the same values in my-custom-values.yaml. It's essentially bundling the pre-existent chart into a new one with my custom values.

Is there a way to do this? I think I might be able to clone the source chart, but I don't feel like that's a practical thing to do.

-- Psycho Punch
google-kubernetes-engine
kubernetes
kubernetes-helm

1 Answer

10/10/2018

What is the issue with the first variation? If you have a custom values.yaml that you can pass to helm why do you need to remove it from the command line?

But if you are ready to play around a bit... :)

One way of doing this would be creating your own chart, that will be mainly empty but consist of a requirements.yaml that refers to stable/target-chart.

requirements.yaml (just beside Chart.yaml)

dependencies:
  - name: stable/target-chart
    version: 1.0.0.0.0.0
    alias: somealiasforvaluesyaml

In your values.yaml you then overwrite the values of that sub-chart:

somealiasforvaluesyaml:
  keyfromthattargetchart: newvalue

  subkeyfromthattargetchart:
    enabled: true
    setting: "value"

The alias you give in the requirements.yaml is the section in your values.yaml from your chart.

Before installing you need to tell helm to update these requirements:

helm repo update
helm dependency update

and then just helm install this (virtual?) chart. This chart does not contain any resources to it would not be called a package in linux package managers - but they also use transitional packages or packages that just are a collection of others (like the build-essential)

Considering you already have the values.yaml to overwrite the ones in the target-chart this is all a bit much? Since the cust-values .yaml to pass to install with -f just needs to contain the customization as it will ammend the values.yaml from the target-chart your first command in the question looks like the correct way to go.

-- wemu
Source: StackOverflow