feat: Helmfile renders *.yaml.gotmpl in a K8s manifests/kustomization directory (#1745)

Related to #494

This feature is mostly a built-in alternative to the `incubator/raw` chart without external dependency and has
access to helmfile's own template functions and template data.

The expected use-case of this feature is to add arbitrary K8s resources to your deployment.

Unlike the original issue raised in #494 this doesn't enable you to add arbitary resources to a release. That's another story. But this would be a good foundation for that, too.
This commit is contained in:
Yusuke Kuoka
2021-04-06 14:22:34 +09:00
committed by GitHub
parent 85accf7330
commit f614e8b1bf
6 changed files with 29 additions and 6 deletions
+7 -1
View File
@@ -6,7 +6,7 @@ import (
"text/template"
)
func (c *Context) newTemplate() *template.Template {
func (c *Context) CreateFuncMap() template.FuncMap {
aliased := template.FuncMap{}
aliases := map[string]string{
@@ -27,6 +27,12 @@ func (c *Context) newTemplate() *template.Template {
funcMap[name] = f
}
return funcMap
}
func (c *Context) newTemplate() *template.Template {
funcMap := c.CreateFuncMap()
tmpl := template.New("stringTemplate").Funcs(funcMap)
if c.preRender {
tmpl = tmpl.Option("missingkey=zero")