多行字符串到头盔模板中的变量? [英] multiline string to a variable in a helm template?

查看:79
本文介绍了多行字符串到头盔模板中的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在头盔模板中为变量分配多行字符串?

Is it possible to assign a multiline string to a variable in a helm template?

我有一个变量,如下所示:

I have a variable as follows:

{{- $fullDescription := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -}}

但是我宁愿将其保留在我的代码库中

but I would prefer to keep it in my code base as

{{- $fullDescription :|- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -}}

..但这不是有效的Yaml.

.. but this is not valid yaml.

可以做到吗?

推荐答案

我通过在单独的文件中包含所需的内容来解决此问题.

I worked around this issue by including the content I require from a separate file.

例如.

  fullDescription: |-
{{ .Files.Get files/description.html | indent 4 }}

这篇关于多行字符串到头盔模板中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆