Documentation ¶
Index ¶
- func FuncMap(secretReaders []SecretReaderFunc) template.FuncMap
- func Render(input string, data interface{}) (content string, err error)
- func RenderContext(templateContext Context, input string) (string, error)
- func RenderContextWithData(templateContext Context, input string, data interface{}) (content string, err error)
- func SecretReaders(secretReaders []SecretReaderFunc) func(string) (map[string]interface{}, error)
- type Context
- type ContextOption
- type ErrNoTable
- type ErrNoValue
- type Files
- type SecretReaderFunc
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuncMap ¶
func FuncMap(secretReaders []SecretReaderFunc) template.FuncMap
FuncMap returns a mapping of all of the functions that Temmplate has.
func RenderContext ¶
RenderContext compile and assemble attribute template to merge with values.
func RenderContextWithData ¶
func RenderContextWithData(templateContext Context, input string, data interface{}) (content string, err error)
RenderContextWithData compile and assemble attribute template to merge with values.
func SecretReaders ¶
func SecretReaders(secretReaders []SecretReaderFunc) func(string) (map[string]interface{}, error)
SecretReaders uses given secret reader funcs to resolve secret path.
Types ¶
type Context ¶
type Context interface { Name() string StrictMode() bool Delims() (string, string) SecretReaders() []SecretReaderFunc Values() Values Files() Files }
Context describes engine rendering context contract.
func NewContext ¶
func NewContext(opts ...ContextOption) Context
NewContext returns a template rendering context.
type ContextOption ¶
type ContextOption func(*context)
ContextOption defines context functional builder function
func WithDelims ¶
func WithDelims(left, right string) ContextOption
WithDelims defines used delimiters for rendering engine.
func WithSecretReaders ¶
func WithSecretReaders(values ...SecretReaderFunc) ContextOption
WithSecretReaders defines secret resolver functions used by `secret` template function.
func WithStrictMode ¶
func WithStrictMode(value bool) ContextOption
WithStrictMode enable or disable strict rendering mode.
func WithValues ¶
func WithValues(values Values) ContextOption
WithValues defines template values injected via CLI.
type ErrNoTable ¶
type ErrNoTable struct {
Key string
}
ErrNoTable indicates that a chart does not have a matching table.
func (ErrNoTable) Error ¶
func (e ErrNoTable) Error() string
type ErrNoValue ¶
type ErrNoValue struct {
Key string
}
ErrNoValue indicates that Values does not contain a key with a value
func (ErrNoValue) Error ¶
func (e ErrNoValue) Error() string
type Files ¶
Files is a map of files that can be accessed from a template.
func NewFiles ¶
func NewFiles(from []*files.BufferedFile) Files
NewFiles returns an engine file collection from file loader.
func (Files) AsConfig ¶
AsConfig returns a Files group and flattens it to a YAML map suitable for including in the 'data' section of a Kubernetes ConfigMap definition. Duplicate keys will be overwritten, so be aware that your file names (regardless of path) should be unique.
The output will not be indented, so you will want to pipe this to the 'indent' template function.
data:
{{ .Files.Glob("config/**").AsConfig() | toYaml | indent 4 }}
func (Files) AsSecrets ¶
AsSecrets returns the base64-encoded value of a Files object suitable for including in the 'data' section of a Kubernetes Secret definition. Duplicate keys will be overwritten, so be aware that your file names (regardless of path) should be unique.
The output will not be indented, so you will want to pipe this to the 'indent' template function.
data:
{{ .Files.Glob("secrets/*").AsSecrets() | toYaml }}
func (Files) Get ¶
Get returns a string representation of the given file.
Fetch the contents of a file as a string. It is designed to be called in a template.
{{.Files.Get "foo"}}
func (Files) GetBytes ¶
GetBytes gets a file by path.
The returned data is raw. In a template context, this is identical to calling {{index .Files $path}}.
This is intended to be accessed from within a template, so a missed key returns an empty []byte.
type SecretReaderFunc ¶
SecretReaderFunc is a function to retrieve a secret from a given path.
type Values ¶
type Values map[string]interface{}
Values represents a collection of template values.
func ReadValues ¶
ReadValues will parse YAML byte data into a Values.
func (Values) AsMap ¶
AsMap is a utility function for converting Values to a map[string]interface{}.
It protects against nil map panics.
func (Values) PathValue ¶
PathValue takes a path that traverses a YAML structure and returns the value at the end of that path. The path starts at the root of the YAML structure and is comprised of YAML keys separated by periods. Given the following YAML data the value at path "chapter.one.title" is "Loomings".
chapter: one: title: "Loomings"