pkg/chart/chart: add Manifests field for untemplated manifests

This commit adds an ability to skip rendering engine for certain
manfiests, when building the chart object programmatically.

This allows to completely skip templating part of helm, while still be
able to use hooks, versioning, upgrades etc. functionality.

Assembling charts programmatically is useful, for example when user wants
to apply post-templating changes to the chart, like kustomize, to avoid
modifying upstream helm chart, but still be able to use helm for
managing the installation.

While for many charts it is fine to be processed by templating engine
multiple times, for others, it is problematic.
The example here are charts, which use similar templating syntax in ConfigMap
objects, so they have to escape {{ }} templating syntax, which is
already non-trivial with helm. The example of such chart is
prometheus-opereator, which brings alerting rules, which also use {{ }}
syntax.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
pull/7405/head
Mateusz Gozdek 6 years ago
parent e84b61b2db
commit 47d5bbfec5
No known key found for this signature in database
GPG Key ID: 8DBCFB00F79374C3

@ -453,6 +453,10 @@ func (c *Configuration) renderResources(ch *chart.Chart, values chartutil.Values
return hs, b, "", err
}
for _, f := range ch.Manifests {
files[f.Name] = string(f.Data)
}
// NOTES.txt gets rendered like all the other files, but because it's not a hook nor a resource,
// pull it out of here into a separate file so that we can actually use the output of the rendered
// text file. We have to spin through this map because the file contains path information, so we

@ -37,6 +37,8 @@ type Chart struct {
Lock *Lock `json:"lock"`
// Templates for this chart.
Templates []*File `json:"templates"`
// Manifests which won't be passed through the rendering engine.
Manifests []*File `json:"manifests"`
// Values are default config for this chart.
Values map[string]interface{} `json:"values"`
// Schema is an optional JSON schema for imposing structure on Values

Loading…
Cancel
Save