watch

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonPredicates

func CommonPredicates() predicate.Funcs

CommonPredicates returns the predicate which filter out the changes done to any field except for spec (e.g. status) Also we should reconcile if finalizers have changed (see https://blog.openshift.com/kubernetes-operators-best-practices/)

func DeleteOnly

func DeleteOnly() predicate.Funcs

DeleteOnly returns a predicate that will filter out everything except the Delete event

func SelectNamespacesPredicate

func SelectNamespacesPredicate(namespaceMap map[string]bool) predicate.Funcs

Types

type DeprecatedResourceWatcher added in v2.2.2

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

DeprecatedResourceWatcher is the object containing the map of watched_resource -> []dependant_resource.

func NewDeprecatedResourceWatcher added in v2.2.2

func NewDeprecatedResourceWatcher() DeprecatedResourceWatcher

NewDeprecatedResourceWatcher creates a new resource watcher.

NOTE: DeprecatedResourceWatcher is DEPRECATED and DISCOURAGED to be used in new implementations. Use controller-runtime intrinsics instead, see https://book.kubebuilder.io/reference/watching-resources/externally-managed.

func (*DeprecatedResourceWatcher) EnsureMultiplesResourcesAreWatched added in v2.2.2

func (r *DeprecatedResourceWatcher) EnsureMultiplesResourcesAreWatched(dependant client.ObjectKey, log *zap.SugaredLogger, resources ...WatchedObject)

func (*DeprecatedResourceWatcher) EnsureResourcesAreWatched added in v2.2.2

func (r *DeprecatedResourceWatcher) EnsureResourcesAreWatched(dependant client.ObjectKey, resourceKind string, log *zap.SugaredLogger, watchedObjectsKeys ...client.ObjectKey)

EnsureResourcesAreWatched registers a dependant for the watched objects. This will let the controller to react on the events for the watched objects and trigger reconciliation for dependants.

func (*DeprecatedResourceWatcher) WatchedResourcesSnapshot added in v2.2.2

func (r *DeprecatedResourceWatcher) WatchedResourcesSnapshot() map[WatchedObject]map[client.ObjectKey]bool

WatchedResourcesSnapshot returns the most recent snapshot of watched resources. Note that entries here can change concurrently.

type EventHandlerWithDelete

type EventHandlerWithDelete struct {
	handler.EnqueueRequestForObject
	Controller interface {
		Delete(ctx context.Context, e event.DeleteEvent) error
	}
}

EventHandlerWithDelete is an extension of EnqueueRequestForObject that will _not_ trigger a reconciliation for a Delete event. Instead, it will call an external controller's Delete() method and pass the event argument unchanged.

func (*EventHandlerWithDelete) Delete

type ResourcesHandler

type ResourcesHandler struct {
	ResourceKind    string
	ResourceWatcher *DeprecatedResourceWatcher
}

ResourcesHandler is a special implementation of 'handler.EventHandler' that checks if the event for WatchedObject must trigger reconciliation for any Operator managed Resource (AtlasProject, AtlasDeployment etc). This is done via consulting the 'TrackedResources' map. The map is stored in relevant Reconciler which ensures it's up-to-date on each reconciliation

func NewBackupScheduleHandler

func NewBackupScheduleHandler(r *DeprecatedResourceWatcher) *ResourcesHandler

func NewSecretHandler

func NewSecretHandler(r *DeprecatedResourceWatcher) *ResourcesHandler

NewSecretHandler TODO Igor: refactor this to create generic constructor

func (*ResourcesHandler) Create

Create handles the Create event for the resource. Note that we implement Create in addition to Update to be able to handle cases when config map or secret is deleted and then created again.

func (*ResourcesHandler) Delete

Delete (Seems we don't need to react on watched resources removal..)

func (*ResourcesHandler) Update

type WatchedObject

type WatchedObject struct {
	ResourceKind string
	Resource     types.NamespacedName
}

WatchedObject is the object watched by controller. Includes its type and namespace+name

func (WatchedObject) String

func (w WatchedObject) String() string

Jump to

Keyboard shortcuts

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