varx/tech on Nostr: Today I have experienced the horror that is #Helm. Helm chart templates make ...
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!
Published at
2023-06-22 00:26:32Event JSON
{
"id": "500d7567ef5870b7be3d6724a4a522261eb371cd9d1b0b33d77cc2d8b413c9bb",
"pubkey": "8e3ac11e1cfbd1959ffff89d016fd2a6c159c4880cf4fe0274ac3852e21f2b88",
"created_at": 1687393592,
"kind": 1,
"tags": [
[
"t",
"helm"
],
[
"t",
"kubernetes"
],
[
"t",
"yaml"
],
[
"mostr",
"https://infosec.exchange/users/varx/statuses/110585026463150565"
]
],
"content": "Today I have experienced the horror that is #Helm.\n\nHelm chart templates make #Kubernetes manifests by string-templating #YAML.\n\nYAML 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.\n\nAnd 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.\n\nCurrently 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!",
"sig": "95792cd61db4bac5eb110a03b7821a07048fec1de906be3bed299917ebdc881480b363510baa2a0f744905d26c8603fdd8322d9111a5bb2849096bedb96462c5"
}