utils

package
v0.0.0-...-b37a37b Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: AGPL-3.0, Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "PLRL"
)

Variables

This section is empty.

Functions

func AddFinalizer

func AddFinalizer(obj metav1.Object, finalizers ...string)

AddFinalizer will add the given finalizer to the object. It uses a StringSet to avoid duplicates.

func GetConfigMapData

func GetConfigMapData(ctx context.Context, client ctrlruntimeclient.Client, namespace string, ref *corev1.ConfigMapKeySelector) (string, error)

func GetEnv

func GetEnv(key, fallback string) string

GetEnv - Lookup the environment variable provided and set to default value if variable isn't found

func GetFuncMap

func GetFuncMap() template.FuncMap

func GetPluralEnv

func GetPluralEnv(key, fallback string) string

GetPluralEnv - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If variable with the provided key is not found, fallback will be used.

func HashObject

func HashObject(a any) (string, error)

func HashString

func HashString(s string) string

func MakeTemplate

func MakeTemplate(tmplate string) (*template.Template, error)

func MarkCondition

func MarkCondition(set func(condition metav1.Condition), conditionType v1alpha1.ConditionType, conditionStatus metav1.ConditionStatus, conditionReason v1alpha1.ConditionReason, message string)

func MarkFalse

func MarkFalse(set func(metav1.Condition), conditionType v1alpha1.ConditionType, conditionReason v1alpha1.ConditionReason, message string)

func MarkTrue

func MarkTrue(set func(metav1.Condition), conditionType v1alpha1.ConditionType, conditionReason v1alpha1.ConditionReason, message string)

func RemoveFinalizer

func RemoveFinalizer(obj metav1.Object, toRemove ...string)

RemoveFinalizer removes the given finalizers from the object.

func RenderString

func RenderString(tmplate string, ctx map[string]interface{}) (string, error)

func RenderTemplate

func RenderTemplate(wr io.Writer, tmplate string, ctx map[string]interface{}) error

func SyncCondition

func SyncCondition(set func(condition metav1.Condition), conditionType, status, reason, message *string)

func TryAddControllerRef

func TryAddControllerRef(ctx context.Context, client ctrlruntimeclient.Client, owner ctrlruntimeclient.Object, controlled ctrlruntimeclient.Object, scheme *runtime.Scheme) error

func TryAddFinalizer

func TryAddFinalizer(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, finalizers ...string) error

func TryRemoveFinalizer

func TryRemoveFinalizer(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, finalizers ...string) error

func TryRemoveOwnerRef

func TryRemoveOwnerRef(ctx context.Context, client ctrlruntimeclient.Client, owner ctrlruntimeclient.Object, controlled ctrlruntimeclient.Object, scheme *runtime.Scheme) error

func TryToUpdate

func TryToUpdate(ctx context.Context, client ctrlruntimeclient.Client, object ctrlruntimeclient.Object) error

func TryUpdateStatus

func TryUpdateStatus[PatchObject ctrlruntimeclient.Object](ctx context.Context, client ctrlruntimeclient.Client, object PatchObject, patch Patcher[PatchObject]) error

TryUpdateStatus TODO ...

Types

type ConsoleHelper

type ConsoleHelper struct {
	// contains filtered or unexported fields
}

func NewConsoleHelper

func NewConsoleHelper(ctx context.Context, k8sClient k8sclient.Client) *ConsoleHelper

func (*ConsoleHelper) IDFromRef

func (in *ConsoleHelper) IDFromRef(ref *v1.ObjectReference, resource v1alpha1.PluralResource) (*string, error)

type Patcher

type Patcher[PatchObject ctrlruntimeclient.Object] func(object PatchObject, original PatchObject) (compare any, compareTo any)

Patcher TODO ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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