helm-classic
helm-classic copied to clipboard
2 generators run initially... then 4 subsequently
I'm not sure I understand why this happens:
[kent@mbp ~]$ helm fetch deis/deis-dev
---> Fetched chart into workspace /Users/kent/.helm/workspace/charts/deis-dev
---> Done
[kent@mbp ~]$ helm generate deis-dev
---> Ran 2 generators.
[kent@mbp ~]$ helm generate deis-dev
---> Ran 4 generators.
I'm gonna guess that whatever gets generated also has helm:generate
in the headers
Shouldn't helm generate
only be looking in the tpl
dir for templates? If the generated manifests still mentioned helm:generate
(albeit in a comment), shouldn't those be ignored? I'm probably misunderstanding something. fwiw, this is with the official deis-dev
chart, so the issue should be easily reproducable.
Maybe the generated files shouldn't contain the helm:generate
line?
We don't strip anything out of a file because we don't want to presume intent.
Is this still a problem somewhere? I'd like to take a look.
Alright, so I reproduced the problem with the deis-dev
chart.
The reason it is happening is because the helm:generate
header is inside of a manifest file, and that file operates on itself as input.
There are two design decisions that we made that are resulting in this problem. Both decisions were made intentionally, but I'd be open to reconsidering.
-
helm generate
operates on an entire chart, including the directorymanifests
. While we don't recommend people store templates in manifests, we don't prevent the generator from checking that directory. We could do this. -
helm generate
itself NEVER modifies a file. So it will not strip a generate header from output, or do any other modification. And the template engine doesn't removehelm:generate
headers. While we could change this behavior, I'm not all that keen on this.
Thoughts?
I thought requiring templates to live only in tpl/
(and ignoring them in manifests/
) is too much magical behavior. At least I wouldn't expect it.
Stripping the helm:generate
header seemed reasonable to me. Or you could rewrite it as helm:generated
and otherwise keep it intact. The problem is obviously when there's a template actually in the destination manifests/
directory, then helm:generate
would only work once under this proposal, and you'd have to "reset" the templates by editing them to say helm:generate
again...ugly.
I guess on balance solution 1. seems saner. Or there's:
- leave this all as-is since the bug is mostly benign :disappointed:
If we leave it as is, it remains a head scratching moment for anyone who just wants to regenerate secrets and such on the chart they already have (meaning no update) to bootstrap a second cluster or replacement cluster.
Or... we could use the --exclude
flag that's been in there the whole time, but which I forgot about.
$ helm generate --exclude=manifests