utils

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Base32EncodeStdLowerCase = "abcdefghijklmnopqrstuvwxyz234567"
)

Variables

This section is empty.

Functions

func InitializeControllerLogger

func InitializeControllerLogger(ctx context.Context, name string) (logging.Logger, context.Context)

InitializeControllerLogger initializes a new logger. Panics if the context doesn't already contain a logger. The given name is added to the logger (it's supposed to be the controller's name). Returns the logger and the context containing it.

func IsNil

func IsNil(i any) bool

IsNil checks if a given pointer is nil. Opposed to 'i == nil', this works for typed and untyped nil values.

func K8sNameHash

func K8sNameHash(ids ...string) string

K8sNameHash takes any number of string arguments and computes a hash out of it, which is then base32-encoded to be a valid k8s resource name. The arguments are joined with '/' before being hashed.

func PrefixWithNamespace

func PrefixWithNamespace(sourceNamespace, name string) string

PrefixWithNamespace prefixes the given name with the sourceNamespace.

func ScopeToControlPlane

func ScopeToControlPlane(cpMeta *metav1.ObjectMeta, ids ...string) string

ScopeToControlPlane is a convenience function which wraps K8sNameHash(cpMeta.Namespace, cpMeta.Name, ids...).

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL