[Controller] Consider implementing Predicates
Summary
The Operator Framework documentation discusses Predicates:
Events are produced by Sources assigned to resources a controller is watching. These events are transformed into Requests by EventHandlers and passed to Reconcile(). Predicates allow controllers to filter events before they are provided to EventHandlers. Filtering is useful because your controller may only want to handle specific types of events. Filtering also helps reduce chattiness with the API server, as Reconcile() is only called for events transformed by EventHandlers.
I've seen them used in other Operators, and the portion about reducing chattiness with the API server sounds important along with the added intentionality we'd gain when parsing events.
A note on use cases:
Predicates are not necessary for many operators, although filtering reduces the amount of chatter to the API server from Reconcile(). They are particularly useful for controllers that watch resources cluster-wide, i.e. without a namespace.
Acceptance criteria
-
Predicates are evaluated to determine if they have a use in our GitLab Operator -
If Predicates have a use in our Operator, then create issue(s) to add the functionality