简体   繁体   English

Helm 覆盖 values.yaml 并在数组中设置

[英]Helm override values.yaml with set in array

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".我们想要覆盖列表项“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 .我的期望是--set ingress.hosts[0].host="www.myhost.com"会这样做,但我们看到一个错误,指出no matches found: ingress.hosts[0].host=www.myhost.com

What am I missing?我错过了什么? This is Helm 3.9.2.这是 Helm 3.9.2。

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: Zsh中的方括号具有特殊含义,因此如果您使用Zsh (根据您的错误,我认为是这种情况),您只需通过在它们前面加上\ (反斜杠)来转义它们:

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

or by adding noglob before your command:或通过在您的命令之前添加noglob

noglob helm ...

You can also escape them by default by adding this alias to your .zshrc :您也可以通过将此别名添加到您的.zshrc来默认转义它们:

alias helm='noglob helm'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM