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

Including files for helmDefaults and repositories #380

Closed
gorzek opened this issue Oct 5, 2018 · 3 comments
Closed

Including files for helmDefaults and repositories #380

gorzek opened this issue Oct 5, 2018 · 3 comments

Comments

@gorzek
Copy link

gorzek commented Oct 5, 2018

Hello,

We are new to using helmfile and attempting to do something that we have not been able to find a good example for. We want to split out our helmDefaults and repository list into their own files that can simply be included in each of our helmfile.d manifests. We're trying to do it this way:

{{ readFile "repositories.yaml" }}
---
{{ readFile "helmdefaults.yaml" }}
---
context: mykube           # kube-context (--kube-context)

releases:
...

This produces mapping errors in the linter:

failed to read helmfile.d\001.cert-manager.yaml: reading document at index 1: yaml: unmarshal errors:
  line 4: cannot unmarshal !!map into string
  line 5: cannot unmarshal !!map into string

repositories.yaml contains templates for environment variables, too, if that makes a difference.

Is this a bug or are we using readFile incorrectly?

Would greatly appreciate any help with this.

@patrickmslatteryvt
Copy link

I was able to use the workaround of putting the contents of repositories.yaml and helmdefaults.yaml into /helmfile.d/000.helmfile.yaml and then I was able to get a successful helmfile lint
Is this the preferred solution though?

@mumoshu
Copy link
Collaborator

mumoshu commented May 28, 2019

Hey! Sorry for the long silence but I finally caught this :)

The work-around mentioned by @patrickmslatteryvt has been never supposed to work. I recently knew about it in #568 which surprised me a LOT!

The bad news is that the bug allowed the workaround was unfortunately fixed recently, which means that it won't work anymore.

The good news is that since #587 helmfile allows you to import subets of helmfile state file as "layers" via :bases. Please see the "writing advanced helmfiles" doc under the docs/ directory for more information.

Now,

{{ readFile "repositories.yaml" }}
---
{{ readFile "helmdefaults.yaml" }}
---
context: mykube           # kube-context (--kube-context)

releases:
...

This would just work. Or you can use bases: [ "repositories.yaml"] instead of {{ readFile ... }}.

@mumoshu
Copy link
Collaborator

mumoshu commented May 28, 2019

Closing this as FINALLY resolved. But please feel free to reopen if necessary!

@mumoshu mumoshu closed this as completed May 28, 2019
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

No branches or pull requests

3 participants