简体   繁体   English

如何将文件内容传递给 Helm values.yaml

[英]How to pass the content of a file to Helm values.yaml

I want to use Helm chart of RabbitMQ to set up a cluster but when I try to pass the configuration files that we have at the moment to the values.yaml it doesn't work.我想使用 RabbitMQ 的 Helm chart 来设置集群,但是当我尝试将我们目前拥有的配置文件传递给 values.yaml 时,它不起作用。

The command that I use:我使用的命令:

helm install --dry-run --debug stable/rabbitmq --name testrmq --namespace rmq -f rabbit-values.yaml

rabbit-values.yaml:兔子值.yaml:

rabbitmq:
  plugins: "rabbitmq_management rabbitmq_federation rabbitmq_federation_management rabbitmq_shovel rabbitmq_shovel_management rabbitmq_mqtt rabbitmq_web_stomp rabbitmq_peer_discovery_k8s"
  advancedConfiguration: |-
    {{ .Files.Get "rabbitmq.config" | quote}}

And what I get for advancedConfiguration :我从advancedConfiguration得到了什么:

NAME:   testrmq
REVISION: 1
RELEASED: Thu Aug 29 10:09:26 2019
CHART: rabbitmq-5.5.0
USER-SUPPLIED VALUES:
rabbitmq:
  advancedConfiguration: '{{ .Files.Get "rabbitmq.config" | quote}}'
  plugins: rabbitmq_management rabbitmq_federation rabbitmq_federation_management
    rabbitmq_shovel rabbitmq_shovel_management rabbitmq_mqtt rabbitmq_web_stomp rabbitmq_peer_discovery_k8s

I have to mention that:我不得不提的是:

  • rabbitmq.config is an Erlang file rabbitmq.config 是一个 Erlang 文件
  • I tried different things including indentation ( indent 4 )我尝试了不同的东西,包括缩进( indent 4

You can't use Helm templating in the values.yaml file.您不能在values.yaml文件中使用 Helm 模板。 (Unless the chart author has specifically called the tpl function when the value is used; for this variable it doesn't , and that's usually called out in the chart documentation.) (除非图表作者在使用该值时专门调用了tpl函数;对于这个变量, 它没有,这通常在图表文档中被调用。)

Your two options are to directly embed the file content in the values.yaml file you're passing in, or to use the Helm --set-file option (link to v2 docs).您的两个选项是直接将文件内容嵌入到您传入的values.yaml文件中,或者使用Helm --set-file选项(链接到 v2 文档)。

helm install --dry-run --debug \
  stable/rabbitmq \
  --name testrmq \
  --namespace rmq \
  -f rabbit-values.yaml \
  --set-file rabbitmq.advancedConfig=rabbitmq.config

There isn't a way to put a file pointer inside your local values YAML file though.但是,没有办法将文件指针放入本地值 YAML 文件中。

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

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