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 ClusterControlPlaneInitialized(logger logr.Logger) predicate.Funcs
- func ClusterCreateInfraReady(logger logr.Logger) predicate.Funcs
- func ClusterCreateNotPaused(logger logr.Logger) predicate.Funcs
- func ClusterHasTopology(logger logr.Logger) predicate.Funcs
- func ClusterUnpaused(logger logr.Logger) predicate.Funcs
- func ClusterUnpausedAndInfrastructureReady(logger logr.Logger) predicate.Funcs
- func ClusterUpdateInfraReady(logger logr.Logger) predicate.Funcs
- func ClusterUpdateUnpaused(logger logr.Logger) predicate.Funcs
- func ResourceHasFilterLabel(logger logr.Logger, labelValue string) predicate.Funcs
- func ResourceIsNotExternallyManaged(logger logr.Logger) predicate.Funcs
- func ResourceIsTopologyOwned(logger logr.Logger) 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 ClusterControlPlaneInitialized ¶ added in v1.1.4
ClusterControlPlaneInitialized returns a Predicate that returns true on Update events when ControlPlaneInitializedCondition on a Cluster changes to true. Example use:
err := controller.Watch( &source.Kind{Type: &clusterv1.Cluster{}}, &handler.EnqueueRequestsFromMapFunc{ ToRequests: clusterToMachines, }, predicates.ClusterControlPlaneInitialized(r.Log), )
func ClusterCreateInfraReady ¶
ClusterCreateInfraReady returns a predicate that returns true for a create event when a cluster has Status.InfrastructureReady set as true it also returns true if the resource provided is not a Cluster to allow for use with controller-runtime NewControllerManagedBy.
func ClusterCreateNotPaused ¶
ClusterCreateNotPaused returns a predicate that returns true for a create event when a cluster has Spec.Paused set as false it also returns true if the resource provided is not a Cluster to allow for use with controller-runtime NewControllerManagedBy.
func ClusterHasTopology ¶ added in v0.99.99
ClusterHasTopology returns a Predicate that returns true when cluster.Spec.Topology is NOT nil and false otherwise.
func ClusterUnpaused ¶
ClusterUnpaused returns a Predicate that returns true on Cluster creation events where Cluster.Spec.Paused is false and Update events when Cluster.Spec.Paused transitions to false. This implements a common requirement for many cluster-api and provider controllers (such as Cluster Infrastructure controllers) to resume reconciliation when the Cluster is unpaused. Example use:
err := controller.Watch( &source.Kind{Type: &clusterv1.Cluster{}}, &handler.EnqueueRequestsFromMapFunc{ ToRequests: clusterToMachines, }, predicates.ClusterUnpaused(r.Log), )
func ClusterUnpausedAndInfrastructureReady ¶
ClusterUnpausedAndInfrastructureReady returns a Predicate that returns true on Cluster creation events where both Cluster.Spec.Paused is false and Cluster.Status.InfrastructureReady is true and Update events when either Cluster.Spec.Paused transitions to false or Cluster.Status.InfrastructureReady transitions to true. This implements a common requirement for some cluster-api and provider controllers (such as Machine Infrastructure controllers) to resume reconciliation when the Cluster is unpaused and when the infrastructure becomes ready. Example use:
err := controller.Watch( &source.Kind{Type: &clusterv1.Cluster{}}, &handler.EnqueueRequestsFromMapFunc{ ToRequests: clusterToMachines, }, predicates.ClusterUnpausedAndInfrastructureReady(r.Log), )
func ClusterUpdateInfraReady ¶
ClusterUpdateInfraReady returns a predicate that returns true for an update event when a cluster has Status.InfrastructureReady changed from false to true it also returns true if the resource provided is not a Cluster to allow for use with controller-runtime NewControllerManagedBy.
func ClusterUpdateUnpaused ¶
ClusterUpdateUnpaused returns a predicate that returns true for an update event when a cluster has Spec.Paused changed from true to false it also returns true if the resource provided is not a Cluster to allow for use with controller-runtime NewControllerManagedBy.
func ResourceHasFilterLabel ¶ added in v0.4.0
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 ResourceIsNotExternallyManaged ¶ added in v0.4.0
ResourceIsNotExternallyManaged returns a predicate that returns true only if the resource does not contain the externally managed annotation. This implements a requirement for InfraCluster providers to be able to ignore externally managed cluster infrastructure.
func ResourceIsTopologyOwned ¶ added in v0.4.3
ResourceIsTopologyOwned returns a predicate that returns true only if the resource has the `topology.cluster.x-k8s.io/owned` label.
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 }
func ResourceNotPausedAndHasFilterLabel ¶ added in v0.4.0
ResourceNotPausedAndHasFilterLabel returns a predicate that returns true only if the ResourceNotPaused and ResourceHasFilterLabel predicates return true.
Types ¶
This section is empty.