Documentation
¶
Overview ¶
Package files provides templating functions based on github.com/helm/helm/pkg/chartutil/files.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromJson ¶
FromJson converts a JSON document into a map[string]interface{}.
This is not a general-purpose JSON parser, and will not parse all valid JSON documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.
func FromYaml ¶
FromYaml converts a YAML document into a map[string]interface{}.
This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.
func ToJson ¶
func ToJson(v interface{}) string
ToJson takes an interface, marshals it to json, and returns a string. It will always return a string, even on marshal error (empty string).
This is designed to be called from a template.
Types ¶
type Dir ¶
type Dir string
Dir is the path to load relative files from.
func (Dir) 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"}}
type Files ¶
Files is a map of files in a chart that can be accessed from a template.
func (Files) AsConfig ¶
AsConfig turns 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.
This is designed to be called from a template, and will return empty string (via ToYaml function) if it cannot be serialized to YAML, or if the Files object is nil.
The output will not be indented, so you will want to pipe this to the 'indent' template function.
data:
{{ (.Files.Glob "config/**").AsConfig() | 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.
This is designed to be called from a template, and will return empty string (via ToYaml function) if it cannot be serialized to YAML, or if the Files object is nil.
The output will not be indented, so you will want to pipe this to the 'indent' template function.
data:
{{ (.Files.Glob "secrets/*").AsSecrets() }}