'how to define a new value (list format) for substitution in helm template
I need to provide an array to be integrated in helm template like this:
deployment.yaml helm template (truncated):
containers:
- ports:
{{ range $Values.PORTS }} ??
{{- end }} ??
...
{{- with $Values.livenessProbe}}
livenessProbe:
httpGet:
port: {{ $Values.PORTS[0].containerPort }} ?? --> the first port retrieved in array
{{- end}}
with this as values in file:
PORTS:
- containerPort: 1111
protocol: TCP
name: cont1
- containerPort: 2222
protocol: TCP
name: cont2
the expected result should be (deployment yaml file):
containers:
- ports:
- containerPort: 1111
protocol: TCP
name: cont1
- containerPort: 2222
protocol: TCP
name: cont2
...
livenessProbe:
httpGet:
port: 1111
Also, I need to check if PORTS key has value defined as array (not string) - condition to add in helm chart
thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
