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

feat: more support towards helmfile per team/microservice #247

Closed
mumoshu opened this issue Aug 29, 2018 · 5 comments
Closed

feat: more support towards helmfile per team/microservice #247

mumoshu opened this issue Aug 29, 2018 · 5 comments

Comments

@mumoshu
Copy link
Collaborator

mumoshu commented Aug 29, 2018

In #96 we have discussed about merging multiple sub-helmfiles into a single or central one, but stayed in favor of #151 #160. However it doesn't necessarily mean #160 is the end result.

How about introducing helmfiles: in helmfile.yaml to do the same thing with the helmfile.d feature, but for sub-helmfile located in arbitrary paths?

For example. this example helmfile.yaml would work exactly same as the helmfile.d:

helmfiles:
- helmfile.d/*.yaml

Helmfiles are sorted alphabetically per group = array item inside helmfiles:, so that you have granular control over ordering(#137).


Suppose I have my microservices organized in a Git reposistory that looks like:

  • myteam/ (sometimes it is equivalent to a k8s ns, that is kube-system for clusterops team)
    • apps/
      • filebeat/
        • helmfile.yaml (no charts/ exists, because it depends on the stable/filebeat chart hosted on the official helm charts repository)
        • README.md (each app managed by my team has a dedicated README maintained by the owners of the app)
      • metricbeat/
        • helmfile.yaml
        • README.md
      • elastalert-operator/
        • helmfile.yaml
        • README.md
        • charts/
          • elastalert-operator/
            • <the content of the helm chart>

One of the benefits of this structure is that you can run git diff thing to locate in which directory=microservice a git commit has changes. My CI system is able to run a workflow for the changed microservice only.

A downside of this is that you don't have an obvious way to sync all microservices at once. That is, I have to run:

for d in apps/*; do helmfile -f $d diff; if [ $? -eq 2 ]; then helmfile -f $d sync; fi; done

At this point, you'll start writing a Makefile under myteam/ so that make sync-all will do the job.

The question is, can't we do better? I believe we can, with the proposed feature.

You would write a helmfile.yaml like:

helmfiles:
- apps/*/helmfile.yaml

So that you can get rid of the Makefile and the bash snippet.
Just run helmfile sync inside myteam/, and you are done.

@sstarcher
Copy link
Contributor

@mumoshu This concept might also make sense for the environment concept that we talked about in another ticket. As we had the issue of loading the environment before loading the helmfile. In this situation this helmfile.yaml that references other helmfile could load global defaults that could be used by all of the other helmfiles.

@mumoshu
Copy link
Collaborator Author

mumoshu commented Aug 30, 2018

@sstarcher That's absolutely an interesting idea.

As I'm eager to keep each sub-helmfile.yaml self-contained, I won't like "inheriting the whole environment values" into sub-helmfiles.

But I'm certainly ok with helmfile --environment production sync to propagate just the environment name, so that all the sub-helmfiles are synced, conceptually, with helmfile --environment -f apps/filebeat/helmfile.yaml where the filebeat should be replaced by each directory to which the glob pattern matched.

In the apps/filebeat/helmfile.yaml, would you define the filebeat's own production environment":

environments:
  production:
    values:
    - ../some/team-wide/global/values.yaml
    - filebeat/specific/values.yaml

releases:
- name: filebeat
   # snip

How does it sound to you?

@sstarcher
Copy link
Contributor

ya, that makes sense. When you wrote helmfile --environment -f apps/filebeat/helmfile.yaml

Did you mean helmfile --environment production -f apps/filebeat/helmfile.yaml

@mumoshu
Copy link
Collaborator Author

mumoshu commented Aug 30, 2018

Ahh, exactly!

@osterman
Copy link
Contributor

osterman commented Sep 7, 2018

@mumoshu you're on a real tear! love all these new features.

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

No branches or pull requests

3 participants