forked from roboll/helmfile
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Merge multiple docs inside a single helmfile.yaml (roboll#270)
Resolves roboll#254
- Loading branch information
Showing
2 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# The Helmfile Best Practices Guide | ||
|
||
This guide covers the Helmfile’s considered patterns for writing advanced helmfiles. It focuses on how helmfile should be structured and executed. | ||
|
||
## Layering | ||
|
||
You may occasionally end up with many helmfiles that shares common parts like which repositories to use, and whichi release to be bundled by default. | ||
|
||
Use Layering to extract te common parts into a dedicated *library helmfile*s, so that each helmfile becomes DRY. | ||
|
||
Let's assume that your `helmfile.yaml` looks like: | ||
|
||
``` | ||
{ readFile "commons.yaml" }} | ||
--- | ||
{{ readFile "environments.yaml" }} | ||
--- | ||
releases: | ||
- name: myapp | ||
chart: mychart | ||
``` | ||
|
||
Whereas `commons.yaml` contained a monitoring agent: | ||
|
||
```yaml | ||
releases: | ||
- name: metricbaet | ||
chart: stable/metricbeat | ||
``` | ||
And `environments.yaml` contained well-known environments: | ||
|
||
```yaml | ||
environments: | ||
development: | ||
production: | ||
``` | ||
|
||
At run time, template expressions in your `helmfile.yaml` are executed: | ||
|
||
```yaml | ||
releases: | ||
- name: metricbaet | ||
chart: stable/metricbeat | ||
--- | ||
environments: | ||
development: | ||
production: | ||
--- | ||
releases: | ||
- name: myapp | ||
chart: mychart | ||
``` | ||
|
||
Resulting YAML documents are merged in the order of occurrence, | ||
so that your `helmfile.yaml` becomes: | ||
|
||
```yaml | ||
environments: | ||
development: | ||
production: | ||
releases: | ||
- name: metricbaet | ||
chart: stable/metricbeat | ||
- name: myapp | ||
chart: mychart | ||
``` | ||
|
||
Great! | ||
|
||
Now, repeat the above steps for each your `helmfile.yaml`, so that all your helmfiles becomes DRY. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters