2
votes

I have been implementing helm sub-chart by referring helm sub chart documentation. According to the documentation it worked for me. This works fine with default value files. But when I try to refer my own value file, the values are not there in the configmap. My value file is values.staging.yaml.

eg :-

config.yaml in mysubchart

apiVersion: v1
kind: ConfigMap
metadata:
    name: {{ .Release.Name }}-configmap
data:
    salad: {{ .Values.dessert }}

values.staging.yaml in mysubchart

dessert: banana

values.yaml in mysubchart

dessert: cake

Only 'cake' is referenced as the value. I need to reference banana as the value.

I have tried following commands.

  1. helm install --dry-run --debug mychart --values mychart/charts/mysubchart/values.staging.yaml
  2. helm install --dry-run --debug --name mychart mychart -f mychart/charts/mysubchart/values.staging.yaml
  3. helm install --name mychart mychart -f mychart/charts/mysubchart/values.staging.yaml

In each instance the configmap does not refer the value in the values.staging.yaml.

Is there a way to do this?

Thank you .!

1
Can you add an example to the question? In the values file you're trying to use, are the keys you're trying to set under a top-level key that's the name of the subchart?David Maze
I have edited question adding an example @DavidMazeTharindu

1 Answers

2
votes

As described in Overriding Values of a Child Chart in your link, you need to wrap the subchart values in a key matching the name of the subchart.

Any values file you pass with helm install -f is always interpreted at the top level, even if it's physically located in a subchart's directory. A typical values file could look like

mysubchart:
  dessert: banana