cluster-api: sigs.k8s.io/cluster-api/util/predicates Index | Files

package predicates

import "sigs.k8s.io/cluster-api/util/predicates"

Index

Package Files

cluster_predicates.go generic_predicates.go

func All Uses

func All(logger logr.Logger, predicates ...predicate.Funcs) predicate.Funcs

All returns a predicate that returns true only if all given predicates return true

func Any Uses

func Any(logger logr.Logger, predicates ...predicate.Funcs) predicate.Funcs

Any returns a predicate that returns true only if any given predicate returns true

func ClusterCreateInfraReady Uses

func ClusterCreateInfraReady(logger logr.Logger) predicate.Funcs

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 Uses

func ClusterCreateNotPaused(logger logr.Logger) predicate.Funcs

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 ClusterUnpaused Uses

func ClusterUnpaused(logger logr.Logger) predicate.Funcs

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 Uses

func ClusterUnpausedAndInfrastructureReady(logger logr.Logger) predicate.Funcs

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 Uses

func ClusterUpdateInfraReady(logger logr.Logger) predicate.Funcs

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 Uses

func ClusterUpdateUnpaused(logger logr.Logger) predicate.Funcs

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 ResourceNotPaused Uses

func ResourceNotPaused(logger logr.Logger) predicate.Funcs

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
}

Package predicates imports 7 packages (graph) and is imported by 22 packages. Updated 2020-10-29. Refresh now. Tools for package owners.