controller

package
v1.8.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEventHandlers

func AddEventHandlers(informer cache.SharedInformer, a addFunc, u updateFunc, d deleteFunc)

func AddFunc

func AddFunc(logger logr.Logger, enqueue EnqueueFunc) addFunc

func Cleanup

func Cleanup[T any, R Object[T]](actual []R, expected []R, deleter Deleter) error

func CreateOrUpdate

func CreateOrUpdate[T any, R Object[T], G Getter[R], S Setter[R]](name string, getter G, setter S, build func(R) error) (R, error)

func DeleteFunc

func DeleteFunc(logger logr.Logger, enqueue EnqueueFunc) deleteFunc

func ExplicitKey

func ExplicitKey[K any](parseKey func(K) cache.ExplicitKey) keyFunc

func GetOrNew

func GetOrNew[T any, R Object[T], G Getter[R]](name string, getter G) (R, error)

func MetaNamespaceKey

func MetaNamespaceKey(obj interface{}) (interface{}, error)

func Run

func Run(controllerName string, logger logr.Logger, queue workqueue.RateLimitingInterface, n, maxRetries int, r reconcileFunc, stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced)

func SetAnnotation

func SetAnnotation(obj metav1.Object, key, value string)

func SetLabel

func SetLabel(obj metav1.Object, key, value string) map[string]string

func SetOwner

func SetOwner(obj metav1.Object, apiVersion, kind, name string, uid types.UID)

func Update

func Update[T any, R Object[T], S Setter[R]](setter S, obj R, build func(R) error) (R, error)

func UpdateFunc

func UpdateFunc(logger logr.Logger, enqueue EnqueueFunc) updateFunc

Types

type Deleter

type Deleter interface {
	Delete(context.Context, string, metav1.DeleteOptions) error
}

type EnqueueFunc

type EnqueueFunc func(interface{}) error

func AddDefaultEventHandlers

func AddDefaultEventHandlers(logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface) EnqueueFunc

func AddDelayedDefaultEventHandlers

func AddDelayedDefaultEventHandlers(logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface, delay time.Duration) EnqueueFunc

func AddDelayedExplicitEventHandlers

func AddDelayedExplicitEventHandlers[K any](logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface, delay time.Duration, parseKey func(K) cache.ExplicitKey) EnqueueFunc

func AddDelayedKeyedEventHandlers

func AddDelayedKeyedEventHandlers(logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface, delay time.Duration, parseKey keyFunc) EnqueueFunc

func AddExplicitEventHandlers

func AddExplicitEventHandlers[K any](logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface, parseKey func(K) cache.ExplicitKey) EnqueueFunc

func AddKeyedEventHandlers

func AddKeyedEventHandlers(logger logr.Logger, informer cache.SharedInformer, queue workqueue.RateLimitingInterface, parseKey keyFunc) EnqueueFunc

func LogError

func LogError(logger logr.Logger, inner EnqueueFunc) EnqueueFunc

func Parse

func Parse(parseKey keyFunc, inner EnqueueFunc) EnqueueFunc

type Getter

type Getter[T any] interface {
	Get(string) (T, error)
}

type Object

type Object[T any] interface {
	*T
	metav1.Object
	DeepCopy() *T
}

type Setter

type Setter[T any] interface {
	Create(context.Context, T, metav1.CreateOptions) (T, error)
	Update(context.Context, T, metav1.UpdateOptions) (T, error)
}

Jump to

Keyboard shortcuts

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