3 ms·
String templating of yaml files. Everything is global scope. No sane way of reusing parts of a template. We use helm, but for the life of me, there are some pr
by janpot 7y ago
String templating of yaml files. Everything is global scope. No sane way of reusing parts of a template.
We use helm, but for the life of me, there are some pretty poor design choices in there.
- mfer 7y agoYou can reuse parts of templates. One method is to create templates that are not automatically turned into YAML files and reuse them as needed. There are docs on it at https://helm.sh/docs/topics/chart_template_guide/named_templates/#declaring-and-using-templates-with-define-and-template https://helm.sh/docs/topics/chart_template_guide/named_templ...
- janpot 7y agoah yes, this technique, with its lack of template inputs and way of (not) handling indentation is exactly what I mean.
- mfer 7y agoI'm sorry for the confusion. Go templates have piping which is how this is expected to be handled. There are functions of nindent and indent that handle the indentation. Inputs can be passed in. In fact, in the chart created using `helm create` this happen. For example, if you do `helm create foo` you can find snippets that read `{{- include "foo.labels" . | nindent 4 }}`. This includes a template, passes in `.` (the scope of variables for that template), and passes the output to `nindent` to get the needed indentation. This is just an example and it's using go templates way of doing things.
- mamon 7y agoAnd that's exactly the problem. With better templating language you shouldn't need this "| nindent 4" expression at all.
- mfer 7y agoI see, the problem is with the Go templating syntax. So, more context... Helm was designed to support more than one templating system. The problem was that the majority of people were ok with Go templates so no one contributed support for other systems.
- dilyevsky 7y agoShameless plug - I’ve worked on a dsl tool [0] at my previous gig that addresses these because I was similarly unimpressed with helm [0] - https://github.com/cruise-automation/isopod https://github.com/cruise-automation/isopod