Documentation ¶
Overview ¶
Package predicates implements predicate utilities.
Index ¶
- func All(logger logr.Logger, predicates ...predicate.Funcs) predicate.Funcs
- func Any(logger logr.Logger, predicates ...predicate.Funcs) predicate.Funcs
- func MinerSetCreateNotPaused(logger logr.Logger) predicate.Funcs
- func MinerSetUnpaused(logger logr.Logger) predicate.Funcs
- func MinerSetUpdateUnpaused(logger logr.Logger) predicate.Funcs
- func ResourceHasFilterLabel(logger logr.Logger, labelValue string) predicate.Funcs
- func ResourceNotPaused(logger logr.Logger) predicate.Funcs
- func ResourceNotPausedAndHasFilterLabel(logger logr.Logger, labelValue string) predicate.Funcs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinerSetCreateNotPaused ¶
MinerSetCreateNotPaused returns a predicate that returns true for a create event when a minerset has Spec.Paused set as false it also returns true if the resource provided is not a MinerSet to allow for use with controller-runtime NewControllerManagedBy.
func MinerSetUnpaused ¶
MinerSetUnpaused returns a Predicate that returns true on MinerSet creation events where MinerSet.Spec.Paused is false and Update events when MinerSet.Spec.Paused transitions to false. This implements a common requirement for many minerset-api and provider controllers (such as MinerSet Infrastructure controllers) to resume reconciliation when the MinerSet is unpaused. Example use:
err := controller.Watch( &source.Kind{Type: &v1beta1.MinerSet{}}, &handler.EnqueueRequestsFromMapFunc{ ToRequests: minersetToMiners, }, predicates.MinerSetUnpaused(r.Log), )
func MinerSetUpdateUnpaused ¶
MinerSetUpdateUnpaused returns a predicate that returns true for an update event when a minerset has Spec.Paused changed from true to false it also returns true if the resource provided is not a MinerSet to allow for use with controller-runtime NewControllerManagedBy.
func ResourceHasFilterLabel ¶
ResourceHasFilterLabel returns a predicate that returns true only if the provided resource contains a label with the WatchLabel key and the configured label value exactly.
func ResourceNotPaused ¶
ResourceNotPaused returns a Predicate that returns true only if the provided resource does not contain the paused annotation. This implements a common requirement for all cluster-api and provider controllers skip reconciliation when the paused annotation is present for a resource. Example use:
func (r *MyReconciler) SetupWithManager(mgr ctrl.Manager, options controller.Options) error { controller, err := ctrl.NewControllerManagedBy(mgr). For(&v1.MyType{}). WithOptions(options). WithEventFilter(util.ResourceNotPaused(r.Log)). Build(r) return err }
Types ¶
This section is empty.