I have two helm charts, the second one is nested to the first tree output:
.
└── outerChart
├── charts
│ └── innerChart
│ ├── charts
│ ├── Chart.yaml
│ ├── templates
│ │ ├── deployment.yaml
│ │ ├── _helpers.tpl
│ │ ├── ingress.yaml
│ │ ├── NOTES.txt
│ │ ├── serviceaccount.yaml
│ │ └── service.yaml
│ └── values.yaml
├── Chart.yaml
├── templates
└── values.yaml
I have a global variable in the outer values.yaml:
global:
myreplicacount: 4
In the nested chart there is a values file with
replicaCount: 1
and a deployment that uses it:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "foo.fullname" . }}
labels:
{{ include "foo.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
The straight forward way in order to use the global var is to replace:
replicas: {{ .Values.replicaCount }}
with:
replicas: {{ .Values.global.myreplicacount }}
in the deployment.yaml.
But it possible to use that in the nested values.yaml? I would like to keep the inner chart intact. I am stuck in a situation where one software team provides me the inner chart and another one provides needed configuration through global variables. replicaCount is just an example, they have many variables that need to change and if I edit the inner chart that will make inner chart updates difficult.
Just adding:
replicaCount: {{ .Values.global.myreplicacount }}
in outerChart/charts/innerChart/values.yaml returns
): error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{".Values.global.myreplicacount":interface {}(nil)}