我可以为Helm提供多个values.yaml文件吗 [英] Can I have multiple values.yaml files for Helm
问题描述
在Helm图表中可以有多个values.yaml
文件吗?
Can I have multiple values.yaml
files in a Helm chart?
诸如mychart/templates/internalValues.yaml
,mychart/templates/customSettings.yaml
之类的东西?
通过{{ .Values.property1 }}
可以访问values.yaml
文件中的属性.
如何引用这些自定义values.yaml
文件中的属性?
Accessing properties in a values.yaml
file can be done by {{ .Values.property1 }}
.
How would I reference the properties in these custom values.yaml
files?
推荐答案
默认情况下,Helm仅使用图表根目录中的values.yaml
文件.
Helm by default will only use the values.yaml
file in the root directory of your chart.
在安装时,您可以要求它加载其他值文件.例如,如果您有任何指向不同环境中不同数据库的设置:
You can ask it to load additional values files when you install. For instance, if you have any settings that point to different databases in different environments:
helm install . -f values.production.yaml
通过将其他设置捆绑为文件,然后请Helm读取捆绑的文件. Helm提供了一个 Yaml模板函数中未记录的解析文件,因此原则上您可以执行类似的操作
You could also get a similar effect by bundling additional settings as a file, and asking Helm to read the bundled file. Helm provides an undocumented fromYaml template function which can parse the file, so in principle you can do something like
{{- $v := $.Files.Get "more-values.yaml" | fromYaml }}
foo: {{ $v.bar }}
这篇关于我可以为Helm提供多个values.yaml文件吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!