从helm命令行设置嵌套数据结构?

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

我正在安装prometheus-redis-exporter Helm chart。它的Deployment对象有一种注入注释的方法:

# deployment.yaml
...
  template:
    metadata:
      annotations:
{{ toYaml .Values.annotations | indent 8 }}

通常,如果我提供值文件,我可以这样做:

# values.yaml
annotations:
  foo: bar
  bash: baz

然后安装图表:

helm install --values values.yaml

但是,在某些情况下,使用--set在命令行上指定这些值更简单,我只是不确定如何指定这样的嵌套集。

在命令行上安装helm图表时,如何设置上面的annotations对象:

helm install --set <what_goes_here>
kubernetes-helm
1个回答
5
投票

helm文档有一个The Format and Limitations of --set部分,其中包含您正在寻找的内容。

--set outer.inner=value导致:

outer:
  inner: value

因此,您的整个helm命令如下所示:

helm install --set annotations.foo=bar,annotations.bash=baz stable/prometheus-redis-exporter
© www.soinside.com 2019 - 2024. All rights reserved.