Documentation ¶
Overview ¶
Package engine implements the Go template engine as a Tiller Engine.
Tiller provides a simple interface for taking a Chart and rendering its templates. The 'engine' package implements this interface using Go's built-in 'text/template' package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuncMap ¶
FuncMap returns a mapping of all of the functions that Engine has.
Because some functions are late-bound (e.g. contain context-sensitive data), the functions may not all perform identically outside of an Engine as they will inside of an Engine.
Known late-bound functions:
- "include": This is late-bound in Engine.Render(). The version included in the FuncMap is a placeholder.
- "required": This is late-bound in Engine.Render(). The version included in thhe FuncMap is a placeholder.
Types ¶
type Engine ¶
type Engine struct { // FuncMap contains the template functions that will be passed to each // render call. This may only be modified before the first call to Render. FuncMap template.FuncMap // If strict is enabled, template rendering will fail if a template references // a value that was not passed in. Strict bool }
Engine is an implementation of 'cmd/tiller/environment'.Engine that uses Go templates.
func New ¶
func New() *Engine
New creates a new Go template Engine instance.
The FuncMap is initialized here. You may modify the FuncMap _prior to_ the first invocation of Render.
The FuncMap sets all of the Sprig functions except for those that provide access to the underlying OS (env, expandenv).
func (*Engine) Render ¶
Render takes a chart, optional values, and value overrides, and attempts to render the Go templates.
Render can be called repeatedly on the same engine.
This will look in the chart's 'templates' data (e.g. the 'templates/' directory) and attempt to render the templates there using the values passed in.
Values are scoped to their templates. A dependency template will not have access to the values set for its parent. If chart "foo" includes chart "bar", "bar" will not have access to the values for "foo".
Values should be prepared with something like `chartutils.ReadValues`.
Values are passed through the templates according to scope. If the top layer chart includes the chart foo, which includes the chart bar, the values map will be examined for a table called "foo". If "foo" is found in vals, that section of the values will be passed into the "foo" chart. And if that section contains a value named "bar", that value will be passed on to the bar chart during render time.