Documentation
¶
Index ¶
- func ExtraFuncMap() template.FuncMap
- func GetReferenceResourceName(ctx context.Context, c client.Client, ...) (string, error)
- func GetReferenceResourceNamespace(ctx context.Context, c client.Client, ...) (string, error)
- func RenderClusterTemplateText(ctx context.Context, c client.Client, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtraFuncMap ¶
TxtFuncMap returns an aggregated template function map. Currently (custom functions + sprig)
func GetReferenceResourceName ¶
func GetReferenceResourceName(ctx context.Context, c client.Client, clusterNamespace, clusterName, referencedResourceName string, clusterType libsveltosv1beta1.ClusterType, ) (string, error)
`referencedResourceName` supports templating and can dynamically reference fields from the target cluster object. This allows the name of the referenced resource to be constructed based on any attribute of the cluster, including its namespace, name, and other metadata.
func GetReferenceResourceNamespace ¶
func GetReferenceResourceNamespace(ctx context.Context, c client.Client, clusterNamespace, clusterName, referencedResourceNamespace string, clusterType libsveltosv1beta1.ClusterType, ) (string, error)
GetReferenceResourceNamespace determines the namespace for a referenced resource. If no namespace is provided, the cluster's namespace is used by default. If a namespace is provided, it may be a Go template string that can reference any field of the cluster object.
func RenderClusterTemplateText ¶ added in v1.16.0
func RenderClusterTemplateText(ctx context.Context, c client.Client, clusterNamespace, clusterName, rawTemplate string, clusterType libsveltosv1beta1.ClusterType, ) (string, error)
RenderClusterTemplateText renders rawTemplate as a Go text/template against the target cluster, the same way GetReferenceResourceName does (same template data, same functions, same missingkey=error), but without HTML-escaping values taken from cluster fields.
Use this instead of GetReferenceResourceName/GetReferenceResourceNamespace for a template whose result isn't going to be treated as HTML, such as a URL: html/template turns '&' into '&' and '+' into '+', which corrupts a value like that.
Types ¶
This section is empty.