Documentation
¶
Index ¶
- func CommonPredicates() predicate.Funcs
- func SelectNamespacesPredicate(namespaces []string) predicate.Funcs
- type DeprecatedResourceWatcher
- func (r *DeprecatedResourceWatcher) EnsureMultiplesResourcesAreWatched(dependant client.ObjectKey, log *zap.SugaredLogger, resources ...WatchedObject)
- func (r *DeprecatedResourceWatcher) EnsureResourcesAreWatched(dependant client.ObjectKey, resourceKind string, log *zap.SugaredLogger, ...)
- func (r *DeprecatedResourceWatcher) WatchedResourcesSnapshot() map[WatchedObject]map[client.ObjectKey]bool
- type EventHandlerWithDelete
- type ResourcesHandler
- func (c *ResourcesHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface)
- func (c *ResourcesHandler) Delete(context.Context, event.DeleteEvent, workqueue.RateLimitingInterface)
- func (c *ResourcesHandler) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface)
- func (c *ResourcesHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface)
- type WatchedObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonPredicates ¶
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/)
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 ¶
func (d *EventHandlerWithDelete) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface)
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 NewAtlasTeamHandler ¶
func NewAtlasTeamHandler(r *DeprecatedResourceWatcher) *ResourcesHandler
func NewBackupPolicyHandler ¶
func NewBackupPolicyHandler(r *DeprecatedResourceWatcher) *ResourcesHandler
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 ¶
func (c *ResourcesHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface)
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 ¶
func (c *ResourcesHandler) Delete(context.Context, event.DeleteEvent, workqueue.RateLimitingInterface)
Delete (Seems we don't need to react on watched resources removal..)
func (*ResourcesHandler) Generic ¶
func (c *ResourcesHandler) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface)
func (*ResourcesHandler) Update ¶
func (c *ResourcesHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface)
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