如何在命令行上替换 Helm value.yaml 中数组项中的特定属性值而不是整个数组/映射?

问题描述 投票:0回答:1

当我尝试仅覆盖

map
中数组内的
values.yaml
项中的特定值时,它会替换整个内容并使其仅具有该属性。有没有办法保留默认值并仅覆盖部分?

我的values.yaml有:

envVariables:
  - name: MYSQL_ROOT_PASSWORD
    secretKey:
      name: creds
      data:
        - name: username
          value: root
        - name: password
          value: REPLACE_ME

我想在命令行中替换密码

value
only,但它却将整个结构更改为只有
envVariables[0].secretKey.data[1].value
。财产
name: MYSQL_ROOT_PASSWORD
连同我没有通过的其他一切都消失了。

helm template ./testchart --set envVariables[0].secretKey.data[1].value=pass
kubernetes kubernetes-helm
1个回答
0
投票

如果以下是您想要的命令:

helm template ./testchart --set envVariables[0].secretKey.data[1].value=pass

试试这个会得到你想要的:

helm template ./testchart -f ./testchart/values.yaml --set envVariables[0].secretKey.data[1].value=pass

您@mahgo 在没有明确的“-f /path/to/values.yaml”时描述的行为看起来像一个错误。

© www.soinside.com 2019 - 2024. All rights reserved.