Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helmDefaults not interpreted when defined in separate file #568

Closed
msutter opened this issue Apr 29, 2019 · 4 comments · Fixed by #587
Closed

helmDefaults not interpreted when defined in separate file #568

msutter opened this issue Apr 29, 2019 · 4 comments · Fixed by #587

Comments

@msutter
Copy link
Contributor

msutter commented Apr 29, 2019

I use helmfile.d for my releases and a helm-default.yaml file to define global values.
After upgrading to v 0.54.2, the defaults are no longer interpreted in the releases definitions.

I have to workaround this with a dirty inclusion of the helm default file in my release definitions like this:

{{ readFile "000-helm-defaults.yaml" }}
---
releases:
- name: myrelease1
....

The helmDefaults in separated file was working with version 0.45.3

@mumoshu
Copy link
Collaborator

mumoshu commented May 2, 2019

@msutter Hey! Thanks for reporting.

I think you've found an interesting use of helmfile.d.
Honestly saying, I have no idea how helm-default.yaml's helmDefaults settings have been propagated/replicated to another helmfiles under the same helmfile.d, without explicitly referring to it(if that's what you meant).

I'll try to see what was going on, but in a certain case you need to wait until the addition of bases which has proposed in #388 (comment).

Out of curiosity, would bases help your use-case, too?

@sonjasutter
Copy link

Hi @mumoshu,

Yes sure, bases(includes) would definitively help us to define global vars

@mumoshu
Copy link
Collaborator

mumoshu commented May 13, 2019

After #587, you can use bases: ["000-helm-defaults.yaml"] as well. Also, the original workaround of using readFile remains possible.

mumoshu added a commit that referenced this issue May 14, 2019
feat: helmfile.yaml layering enhancements

The current  [Layering](https://github.com/roboll/helmfile/blob/master/docs/writing-helmfile.md#layering) system didn't work as documented, as it relies on helmfile to template each "part" of your helmfile.yaml THEN merge them one by one.

The reality was that helmfile template all the parts of your helmfile.yaml at once, and then merge those YAML documents. In #388 (comment), @sruon was making a GREAT point that we may need to change helmfile to render templates earlier - that is to evaluate a template per each helmfile.yaml part separated by `---`. Sorry I missed my expertise to follow your great idea last year @sruon  😭 

Anyways, this, in combination with the wrong documentation, has made so many people confused. To finally overcome this situation, here's a fairly large PR that introduces the 2 enhancements:

- `bases:` for easier layering without go template expressions, especially `{{ readFunc "path/to/file" }}`s. This is the first commit of this PR.
- `helmfile.yaml` is splited by the separator `---` at first. Each part is then rendered as a go template(double-render applies as before). Finally, All the results are merged in the order of occurence. I assume this as an enhanced version of @sruon's work. This is the second commit of this PR.

Resolves #388
Resolve #584
Resolves #585 (`HELMFILE_EXPERIMENTA=true -f helmfile.yaml helmfile` disables the whole-file templating, treating the helmfile.yaml as a regular YAML file as the file ext. denotes. Use `helmfile.yaml.gotmpl` or `helmfile.gotmpl` to enable)
Fixes #568 (Use `bases` or `readFile` rather than not importing implicitly with `helmfile.d`
@mumoshu
Copy link
Collaborator

mumoshu commented May 14, 2019

bases will be enabled since helmfile v0.60.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants