Add documentation about re-using the environment state from parent in sub-helmfile (#1808)

Ref #762

Co-authored-by: Vladimir Avdoshka <vavdoshka@kyriba.com>
Co-authored-by: Quan TRAN <itscaro@users.noreply.github.com>
This commit is contained in:
Vladimir Avdoshka 2021-05-01 05:26:00 +02:00 committed by GitHub
parent dabd7ad99f
commit d9e15754b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 0 deletions

View File

@ -373,3 +373,42 @@ releases:
repository: "nginx"
tag: "latest"
```
## Re-using environment state in sub-helmfiles
Do you want to decouple the environment state loading from the sub-helmfiles and load it only once?
This example shows how to do this:
```yaml
environments:
stage:
values:
- env/stage.yaml
prod:
values:
- env/prod.yaml
---
helmfiles:
- path: releases/myrelease/helmfile.yaml
values:
- {{ toYaml .Values | nindent 4 }}
# pass the current state values to the sub-helmfile
# add other values to use overlay logic here
```
and `releases/myrelease/helmfile.yaml` is as DRY as
```yaml
releases:
- name: mychart-{{ .Values.myrelease.myname }}
installed: {{ .Values | get "myrelease.enabled" false }}
chart: mychart
version: {{ .Values.myrelease.version }}
labels:
chart: mychart
values:
- values.yaml.gotmpl
# templated values would also inherit the values passed from upstream
```