feat: inherit field for release template inheritance (#606)

* feat: `inherit` field for release template inheritance

Ref https://github.com/helmfile/helmfile/issues/435#issuecomment-1364749414

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix wording

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Comment on releaseWithInheritedTemplate

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Update Release Template doc with the new `inherit` feature

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* Fix a typo in code comment

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Yusuke Kuoka
2022-12-28 10:01:04 +09:00
committed by GitHub
parent 6b19577987
commit 490bb5d147
9 changed files with 324 additions and 14 deletions
+12 -4
View File
@@ -85,7 +85,7 @@ It allows you to abstract away the repetitions in releases into a template, whic
```yaml
templates:
default: &default
default:
chart: stable/{{`{{ .Release.Name }}`}}
namespace: kube-system
# This prevents helmfile exiting when it encounters a missing file
@@ -102,10 +102,12 @@ templates:
releases:
- name: heapster
version: 0.3.2
<<: *default
inherit:
template: default
- name: kubernetes-dashboard
version: 0.10.0
<<: *default
inherit:
template: default
```
Release Templating supports the following parts of release definition:
@@ -144,7 +146,13 @@ Release Templating supports the following parts of release definition:
# ...
```
See the [issue 428](https://github.com/roboll/helmfile/issues/428) for more context on how this is supposed to work.
Previously, we've been using YAML anchors for release template inheritance.
It turned out not work well when you wanted to nest templates for complex use cases and/or you want a fine control over which fields to inherit or not.
Thus we added a new way for inheritance, which uses the `inherit` field we introduced above.
See [issue helmfile/helmfile#435](https://github.com/helmfile/helmfile/issues/435#issuecomment-1362177510) for more context.
You might also find [issue roboll/helmfile#428](https://github.com/roboll/helmfile/issues/428) useful for more context on how we originally designed the relase template and what it's supposed to solve.
## Layering Release Values