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

Feature Request: Load helmfiles from a directory #151

Closed
osterman opened this issue May 22, 2018 · 12 comments
Closed

Feature Request: Load helmfiles from a directory #151

osterman opened this issue May 22, 2018 · 12 comments

Comments

@osterman
Copy link
Contributor

osterman commented May 22, 2018

what

  • Add support for a --dir option which will process each file as a standalone helmfile.yaml
  • Maybe add a --recursive option to scan directories recursively
    e.g.
helmfile --dir conf.d --selector default=true sync

why

  • It should be much simpler to iterate over files in a directory than figuring out how to merge multiple templatized YAML files
  • Compatibility with CODEOWNERS

use-case

Our helmfile is too big to manage (1330 lines).

additional context

All we're asking is for the equivalent functionality of this:

for conf in conf.d/*; do
  helmfile --file=$conf $@
done

related

@mumoshu
Copy link
Collaborator

mumoshu commented May 22, 2018

@osterman Hi. Thanks for the proposal! I prefer it over helmfile merging yaml files, because it would be straightforward to use.

But I'd rather just add documentation and examples about that use-case if it is just a matter of:

for conf in conf.d/*; do
  helmfile --file=$conf $@
done

So - do you have any specific reason to implement it in helmfile? Perhaps richer error-handling?

@osterman
Copy link
Contributor Author

osterman commented May 22, 2018

@mumoshu it feels like a slippery slope of abstractions. Suppose we call the above "script" helmfiledir.

E.g. we currently do something like this: chamber -> helmfile -> helm -> kubectl

chamber exec backing-services -- helmfile --selector default=true sync

Now we're saying run chamber which will call helmfiledir which will call helmfile which will call helm which will call kubectl.

When will the madness stop!! =)

I look at this propsal as the standard conf.d pattern that is prevalent in many linux apps. Given the nature of what helmfile is trying to solve (complex configurations of helm charts), it seems apt that the functionality belong in the helmfile rather than in yet another wrapper.

references

@mumoshu
Copy link
Collaborator

mumoshu commented May 22, 2018

@osterman Thanks for the response!

Now we're saying run chamber which will call helmfiledir which will call helmfile which will call helm which will call kubectl.

This! I'm going to suffer the almost same thing. Mine adds a bash script that gives AWS and K8S
API access, and kapitan that compiles helmfile.yaml's. Oh my... 😆

What I'm wondering is where helmfile should go. Would it something like "helmfile handles 1 or more helmfile.yaml files well, declaratively, to ease deploying a bunch of helm charts"?

I basically like unix philosophy anyway, and just thinking what this means in the context.

@mumoshu
Copy link
Collaborator

mumoshu commented May 22, 2018

@osterman By the way, would you mind if it was implemented without --dir? So, helmfile -f ./ reads the dir and helmfile -rf ./ does it recursively.

kubectl, which we are familiar with, also handles a directory of manifests that way, right?

@osterman
Copy link
Contributor Author

So, helmfile -f ./ reads the dir and helmfile -rf ./ does it recursively.

Yea, as far as I'm concerned I don't think it matters if we overload the --file argument to handle directories. That said, perhaps renaming --file to --path would be more flexible.

kubectl, which we are familiar with, also handles a directory of manifests that way, right?

Aha, indeed it does, so there would be precedence for doing it this way.

@osterman
Copy link
Contributor Author

Would it something like "helmfile handles 1 or more helmfile.yaml files well, declaratively, to ease deploying a bunch of helm charts"

Yes, I think we're on the same page. Especially with your analogy to kubectl apply -f some-dir/, that's what we're going for with this feature request.

@osterman
Copy link
Contributor Author

Also, to incorporate other feedback from @gtaylor:

I think they should be executed lexicographically. To influence the order of execution, one could organize files like this:

helmfiles.d/10.kube2iam.yaml
helmfiles.d/20.chartmuseum.yaml
helmfiles.d/30.externaldns.yaml

references

@sstarcher
Copy link
Contributor

similar to auto-detecting a helmfile.yaml could we also auto-detect a helmfile.d possibly?

@mumoshu
Copy link
Collaborator

mumoshu commented May 25, 2018

@gtaylor @osterman I agree about the lexical ordering

@mumoshu
Copy link
Collaborator

mumoshu commented May 25, 2018

Sounds good! Any reason not to include the helmfile.d feature in the first PR for this feature?

@mumoshu mumoshu mentioned this issue May 25, 2018
@mumoshu mumoshu changed the title Feature Request: --dir option Feature Request: Load helmfiles from a directory Jun 5, 2018
mumoshu added a commit to mumoshu/helmfile that referenced this issue Jun 6, 2018
mumoshu added a commit to mumoshu/helmfile that referenced this issue Jun 6, 2018
@mumoshu
Copy link
Collaborator

mumoshu commented Jun 6, 2018

I have a WIP PR for this at #160. Would you mind taking a look?
It should support helmfile.d.

Do you have any concrete use-case for --recursive now? Can I defer it to another PR?

@osterman
Copy link
Contributor Author

osterman commented Jun 8, 2018

woohoo! Personally, I don't need a --recursive flag at this point.

mumoshu added a commit that referenced this issue Jun 14, 2018
Resolves #151 #137

Notes:

- You can have either helmfile.d or helmfile.yaml/charts.yaml, not both
raxod502-plaid pushed a commit to raxod502-plaid/helmfile that referenced this issue Jun 30, 2022
Release automation and release build testing
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