Documentation
¶
Index ¶
- func DefaultIfZero[T comparable](v, def T) T
- func EnsureVPAResource(restCfg *rest.Config) error
- func FormatKeys(entries map[string]string) string
- func MergeMaps(a map[string]string, b map[string]string) map[string]string
- func RenderNameTemplate(tmpl string, data NameTemplateData) (string, error)
- func ToCacheOptions(watchNamespaces []string) cache.Options
- func ValidateUniqueKeys(keys map[string]string) error
- type NameTemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultIfZero ¶
func DefaultIfZero[T comparable](v, def T) T
DefaultIfZero returns def when v equals the zero value for T, otherwise returns v. Useful for numeric fields where 0 means "unset".
func EnsureVPAResource ¶
EnsureVPAResource verifies the VerticalPodAutoscaler CRD is installed.
func FormatKeys ¶
FormatKeys returns a sorted, comma-separated string representation of the key/value map.
func RenderNameTemplate ¶
func RenderNameTemplate(tmpl string, data NameTemplateData) (string, error)
RenderNameTemplate renders and validates the provided template as a DNS-1123 subdomain.
func ToCacheOptions ¶
ToCacheOptions returns cache.Options configured to watch the given namespaces. If no namespaces are provided, it returns an empty Options which watches all namespaces.
func ValidateUniqueKeys ¶
ValidateUniqueKeys ensures all provided annotation/label values are unique. Returns an error if the map is empty or if any duplicate values are found.