Template Functions
TemplateFuncs that are always available
The standard Go template and Sprig library functions are always available, as are the following:
assert [message] value
Fails if value is empty, optional message string is included in the error.
A value is "empty" if it is nil, false, zero, or a zero-length string, slice, or map.
Can be used to test multiple values at once:
{{assert "need namespace and name" (all .metadata.namespace .metadata.name)}}
required [message] value
Like assert, but returns the value if it is not empty.
Use to pass through a value:
Name is: {{ .metadata.name | required "name must not be empty" }}.
query queryString
Executes its argument as a korrel8r query string, returns the results as []any.
May return an error.
k8sRouteHost namespace name
Returns the spec.host of the named OpenShift route.
Returns an error if the route is not found.
Generated by gomarkdoc
k8s
TemplateFuncs for the k8s domain.
k8sClass
Takes string arguments (apiVersion, kind).
Returns the korrel8r.Class implied by the arguments, or an error.
k8sIsNamespaced
Takes a k8s Class argument, returns true if the class is a namespace-scoped resource.
k8sHealthStatus
Takes a k8s Object, evaluates its health using the kube-health library.
Returns "Error", "Warning", or "" for healthy/unknown objects.
Analyzes observed generation and standard Kubernetes conditions.
k8sCRDName
Takes string arguments (apiVersion, kind).
Returns the CustomResourceDefinition name (plural.group) for the resource,
or "" if it is a core resource or unknown.
log
TemplateFuncs for the log domain.
logTypeForNamespace string
Returns the log type ("application" or "infrastructure") for logs from that namespace.
logSafeLabel string
Replace all characters other than alphanumerics, '_' and ':' with '_'.
logSafeLabels map[string]string
Returns a map where each key is replaced by the result of logSafeLabel.
netflow
TemplateFuncs for the netflow domain.
netflowTypeToK8s typeString
Convert a netflow type field value to a k8s class.
Generated by gomarkdoc