In chat, I asked about the ability to define an object like this via --set
and was sadly faced with the truth:
env:
- name: ROUTER
value: cake
- name: PASSWORD
value: derp
I like to use stanza's like these in my values.yaml
to define entire env variable needs for a particular container spec, so that in the spec I only need:
env:
{{ toYaml .Values.env | indent 10 }}
There are plenty of reasons this is useful:
deployment
object just because I want to pass a few other variables to the main process.Sadly, passing these types of objects isn't currently supported. Using if statements right in my templates in the best way to get around this for now, but it would be awesome to define large swabs of potentially dynamic information about my app right in values.yaml
I actually just found another way to do this via observing kube-lego
:
{{- range $key, $value := .Values.config }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
My issue is similar.
We want to use the Chart aws-cluster-autoscaler at:
https://github.com/kubernetes/charts/tree/master/stable/aws-cluster-autoscaler
We would like to pass the autoscalingGroups[].name via the command line, using --set
, and the other info via a file params.yaml:
autoscalingGroups:
- minSize: 2
maxSize: 8
awsRegion: eu-west-1
When we try setting the autoscaling group name with:
$ helm upgrade cluster-autoscaler stable/aws-cluster-autoscaler -f params.yaml --set "autoscalingGroups[].name"="nodes.k8s.test.eu-west-1.aws.redacted.net"
But that doesn't work.
Reading the documentation, this is known, but it would still be nice to be able to do this.
This is now possible using the following syntax:
helm install foo --set env[0].name="ROUTER",env[0].value="cake"
This is documented here.
Most helpful comment
This is now possible using the following syntax:
This is documented here.