Home > Software design >  Helm override values.yaml with set in array
Helm override values.yaml with set in array

Time:08-25

I have seen many questions surrounding this topic but no good answer for what I am seeing. We have a values file like so:

ingress:
  enabled: "false"
  className: ""
  annotations:
    {}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  hosts:
    - host: chart-example.local
      paths:
        - path: /
          pathType: ImplementationSpecific

We want to override the value of the list item "host". It was my expectation that --set ingress.hosts[0].host="www.myhost.com" would do this, but we are seeing an error stating no matches found: ingress.hosts[0].host=www.myhost.com.

What am I missing? This is Helm 3.9.2.

CodePudding user response:

Square brackets in Zsh have special meanings, so if you use Zsh (based on your error, I think it's the case), you need just to escape them by putting \ (backslash) before them:

--set ingress.hosts\[0\].host="www.myhost.com"

or by adding noglob before your command:

noglob helm ...

You can also escape them by default by adding this alias to your .zshrc:

alias helm='noglob helm'
  • Related