watch

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 14 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 added in v0.7.0

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

Types

type EventHandlerWithDelete

type EventHandlerWithDelete struct {
	handler.EnqueueRequestForObject
	Controller interface {
		Delete(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 ResourceWatcher

type ResourceWatcher struct {
	WatchedResources map[WatchedObject]map[client.ObjectKey]bool
}

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

func NewResourceWatcher

func NewResourceWatcher() ResourceWatcher

func (ResourceWatcher) EnsureMultiplesResourcesAreWatched added in v1.0.0

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

func (ResourceWatcher) EnsureResourcesAreWatched

func (r ResourceWatcher) 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.

type ResourcesHandler

type ResourcesHandler struct {
	ResourceKind     string
	TrackedResources map[WatchedObject]map[client.ObjectKey]bool
}

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 NewAtlasTeamHandler added in v1.5.0

func NewAtlasTeamHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler

func NewBackupPolicyHandler added in v1.0.0

func NewBackupPolicyHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler

func NewBackupScheduleHandler added in v1.0.0

func NewBackupScheduleHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler

func NewSecretHandler

func NewSecretHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *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) Generic

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