Post AWxI5DfIPvOHKvioPw by varx@infosec.exchange
(DIR) More posts by varx@infosec.exchange
(DIR) Post #AWxHusXK7N8sua3tUu by varx@infosec.exchange
2023-06-22T00:26:32Z
0 likes, 0 repeats
Today I have experienced the horror that is #Helm.Helm chart templates make #Kubernetes manifests by string-templating #YAML.YAML has one of the most unfriendly syntaxes of any textual data structure language I've ever seen. There's a whole website just dedicated to the nine different ways you can write a multiline string.And Helm just... string-interpolates values into it. The most fragile syntax in the world, and you're just going to inject raw bytes straight into it. The only tool provided to alleviate this is the `quote` function, which... doesn't actually do what you want.Currently at work I'm trying to figure out how to insert an arbitrary string value into another string, which is a pretty normal thing to do. And four attempts later, nothing works. The most common "solution" on the web appears to be to use `{{ ... | indent 12 }}` where 12 has to match the template's current indentation level. Good luck if you ever want to reindent anything!
(DIR) Post #AWxHuvz5Ic8BbY4bgW by feld@bikeshed.party
2023-06-22T16:38:23.129711Z
0 likes, 0 repeats
> YAML has one of the most unfriendly syntaxes of any textual data structure language I've ever seen.JSON is a subset of YAML so you can just use JSON and YAML parsers understand it
(DIR) Post #AWxHuwxLgYKwcSGjcO by varx@infosec.exchange
2023-06-22T16:33:13Z
0 likes, 0 repeats
OK, here we go: A way to inject a string value inside a #YAML string in #Helm chart templates!You won't like this."... {{ $someValue | quote | substr 1 (int (sub ($someValue | quote | len) 1)) }} ..."I promise you that this is one of *less* terrible ways of performing this extremely fundamental operation.
(DIR) Post #AWxI5DfIPvOHKvioPw by varx@infosec.exchange
2023-06-22T16:40:03Z
1 likes, 0 repeats
@feld Yeah, but the templating language also doesn't give you a way to interpolate into a JSON string. :-/
(DIR) Post #AWxI8L4pJhURC09QVU by feld@bikeshed.party
2023-06-22T16:40:56.812051Z
0 likes, 0 repeats
now I'm feeling the pain
(DIR) Post #AX5RgI63qEPAhxLXWK by varx@infosec.exchange
2023-06-26T14:01:39Z
4 likes, 6 repeats
#YAML is endless fun.