controllerspi

package
v0.0.0-...-a7b7215 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: UPL-1.0 Imports: 8 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFilter

type EventFilter interface {
	// HandlePredicateEvent is the predicate event handler filter that returns true if the object should be reconciled.
	// This is needed to use same CR for multiple controllers
	HandlePredicateEvent(cli client.Client, object client.Object) bool
}

EventFilter is an interface used by controllers filter events

type Finalizer

type Finalizer interface {
	// GetName returns the name of the finalizer
	GetName() string

	// PreRemoveFinalizer is called when the resource is being deleted, before the finalizer
	// is removed.  Use this method to delete Kubernetes resources, etc.
	PreRemoveFinalizer(ReconcileContext, *unstructured.Unstructured) result.Result

	// PostRemoveFinalizer is called after the finalizer is successfully removed.
	// This method does garbage collection and other tasks that can never return an error
	PostRemoveFinalizer(ReconcileContext, *unstructured.Unstructured)
}

Finalizer is an interface used by controllers the use finalizers

type FuncControllerEventFilter

type FuncControllerEventFilter func(cli client.Client, object client.Object) bool

FuncControllerEventFilter is the predicate event handler filter that returns true if the object should be reconciled. This is needed to use same CR for multiple controllers

type FuncShouldReconcile

type FuncShouldReconcile func(cli client.Client, event WatchEvent) bool

FuncShouldReconcile returns true if the watched object event should trigger reconcile

type ReconcileContext

type ReconcileContext struct {
	// Log is the VerrazzanoLogger
	Log vzlog.VerrazzanoLogger

	// ClientCtx is the context used to make controller runtime client API calls
	ClientCtx context.Context
}

ReconcileContext is a context has the dynamic context needed for a reconcile operation

type Reconciler

type Reconciler interface {
	// Reconcile reconciles the resource
	Reconcile(ReconcileContext, *unstructured.Unstructured) result.Result

	// GetReconcileObject returns the client object being reconciled
	GetReconcileObject() client.Object
}

Reconciler is an interface used by controllers to reconcile a resource

type WatchDescriptor

type WatchDescriptor struct {
	// WatchedResourceKind is the kind of resource being watched
	WatchedResourceKind source.Kind

	// FuncShouldReconcile is called when watch event occurs to determine if CR should be reconciled
	FuncShouldReconcile
}

WatchDescriptor described an object being watched

type WatchEvent

type WatchEvent struct {
	// WatchEventType is the type of watched event
	WatchEventType

	// EventTime is the time the event occurred
	EventTime time.Time

	// NewWatchedObject is the new object that caused the event
	NewWatchedObject client.Object

	// OldWatchedObject is the old object that caused the event. Only valid for update event
	OldWatchedObject client.Object

	// ReconcilingResource is the resource that is potentially being reconciled
	ReconcilingResource types.NamespacedName
}

WatchEvent is an occurrence of a watch event

type WatchEventType

type WatchEventType int

WatchEventType is the type of watched event

const (
	// Created indicates the watched object was created
	Created WatchEventType = iota

	// Updated indicates the watched object was updated
	Updated WatchEventType = iota

	// Deleted indicates the watched object was deleted
	Deleted WatchEventType = iota
)

type Watcher

type Watcher interface {
	// GetWatchDescriptors returns the list of WatchDescriptor for objects being watched
	GetWatchDescriptors() []WatchDescriptor
}

Watcher is an interface used by controllers that watch resources

Jump to

Keyboard shortcuts

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