Helm Functions
Helm functions are provided by the jhelm-gotemplate-helm module.
They are auto-discovered via ServiceLoader when the module is on the classpath (priority 200, overrides Sprig on name collision).
1. Template Functions
| Function | Description |
|---|---|
|
Execute named template and return output as string. Returns empty string on error. |
|
Execute named template and return output. Throws on error. |
|
Evaluate string as template inline. Returns empty string on error. |
|
Evaluate string as template inline. Throws on error. |
|
Validate that a value is present and non-empty. Throws with the provided message if validation fails. |
metadata:
labels:
{{- include "mychart.labels" . | nindent 4 }}
image: {{ required "image.repository is required" .Values.image.repository }}
2. Conversion Functions
2.1. YAML
| Function | Description |
|---|---|
|
Converts object to YAML string. Null fields are omitted, numeric-looking strings are quoted. Returns empty string on error. |
|
Same as |
|
Parses YAML string into a Map. Returns empty map on error. |
|
Same as |
|
Parses YAML string into a List. Returns empty list on error. |
|
Same as |
2.2. JSON
| Function | Description |
|---|---|
|
Converts object to JSON string. Returns |
|
Same as |
|
Converts object to pretty-printed JSON. Returns |
|
Same as |
|
Converts object to JSON without HTML escaping. Returns |
|
Same as |
|
Parses JSON string into a Map. Returns empty map for null, blank, or |
|
Same as |
|
Parses JSON string into a List. Returns empty list for null, blank, or |
|
Same as |
3. Kubernetes Functions
| Function | Description |
|---|---|
|
Query Kubernetes API for resources. Syntax: |
|
Returns Kubernetes cluster version info as a Map with keys |
Kubernetes functions require a KubernetesProvider implementation.
When using ServiceLoader auto-discovery (default), stub implementations are used.
Wire a real provider via GoTemplate.Builder or Spring auto-configuration in jhelm-kube.
|