Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiline string to a variable in a helm template?

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" -}}

.. but this is not valid yaml.

Can this be done?

like image 649
MarkNS Avatar asked Jun 20 '18 14:06

MarkNS


2 Answers

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

Eg.

  fullDescription: |-
{{ .Files.Get files/description.html | indent 4 }}
like image 132
MarkNS Avatar answered Oct 02 '22 15:10

MarkNS


I think it should work like this:

$fullDescription: | +
   "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
like image 29
S.Spieker Avatar answered Oct 02 '22 16:10

S.Spieker