Skip to content
Template Functions

Template Functions

TemplateFuncs that are always available

The standard Go template and Sprig library functions are always available, as are the following:

currentRule
  Returns the [korrel8r.Rule] currently being evaluated

require value
    Returns value if it is not nil, false, zero or empty, otherwise fails.
        Name is: {{ .metadata.name | require }}.

requireAll values...
    Fails if any value is nil, false, zero or empty.
        {{requireAll .metadata.namespace .metadata.name}}

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 string
  converts a netflow type string to a k8s class string.

Generated by gomarkdoc