Documentation ¶
Index ¶
- func CommonPredicates() predicate.Funcs
- func DeleteOnly() predicate.Funcs
- func SelectNamespacesPredicate(namespaceMap map[string]bool) predicate.Funcs
- type EventHandlerWithDelete
- type ResourceWatcher
- type ResourcesHandler
- func NewAtlasTeamHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler
- func NewBackupPolicyHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler
- func NewBackupScheduleHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler
- func NewSecretHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *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/)
func DeleteOnly ¶
DeleteOnly returns a predicate that will filter out everything except the Delete event
Types ¶
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 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 ¶
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 ¶
func NewAtlasTeamHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler
func NewBackupPolicyHandler ¶
func NewBackupPolicyHandler(tracked map[WatchedObject]map[client.ObjectKey]bool) *ResourcesHandler
func NewBackupScheduleHandler ¶
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 ¶
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