Bump sigs.k8s.io/controller-runtime to v0.14.4 (#5507)
* Bump sigs.k8s.io/controller-runtime to v0.14.4 * Update gofmt
This commit is contained in:
41
vendor/sigs.k8s.io/controller-runtime/pkg/predicate/predicate.go
generated
vendored
41
vendor/sigs.k8s.io/controller-runtime/pkg/predicate/predicate.go
generated
vendored
@@ -50,6 +50,7 @@ var _ Predicate = GenerationChangedPredicate{}
|
||||
var _ Predicate = AnnotationChangedPredicate{}
|
||||
var _ Predicate = or{}
|
||||
var _ Predicate = and{}
|
||||
var _ Predicate = not{}
|
||||
|
||||
// Funcs is a function that implements Predicate.
|
||||
type Funcs struct {
|
||||
@@ -176,9 +177,9 @@ func (GenerationChangedPredicate) Update(e event.UpdateEvent) bool {
|
||||
// This predicate will skip update events that have no change in the object's annotation.
|
||||
// It is intended to be used in conjunction with the GenerationChangedPredicate, as in the following example:
|
||||
//
|
||||
// Controller.Watch(
|
||||
// Controller.Watch(
|
||||
// &source.Kind{Type: v1.MyCustomKind},
|
||||
// &handler.EnqueueRequestForObject{},
|
||||
// &handler.EnqueueRequestForObject{},
|
||||
// predicate.Or(predicate.GenerationChangedPredicate{}, predicate.AnnotationChangedPredicate{}))
|
||||
//
|
||||
// This is mostly useful for controllers that needs to trigger both when the resource's generation is incremented
|
||||
@@ -207,9 +208,10 @@ func (AnnotationChangedPredicate) Update(e event.UpdateEvent) bool {
|
||||
// It is intended to be used in conjunction with the GenerationChangedPredicate, as in the following example:
|
||||
//
|
||||
// Controller.Watch(
|
||||
// &source.Kind{Type: v1.MyCustomKind},
|
||||
// &handler.EnqueueRequestForObject{},
|
||||
// predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{}))
|
||||
//
|
||||
// &source.Kind{Type: v1.MyCustomKind},
|
||||
// &handler.EnqueueRequestForObject{},
|
||||
// predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{}))
|
||||
//
|
||||
// This will be helpful when object's labels is carrying some extra specification information beyond object's spec,
|
||||
// and the controller will be triggered if any valid spec change (not only in spec, but also in labels) happens.
|
||||
@@ -339,6 +341,35 @@ func (o or) Generic(e event.GenericEvent) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Not returns a predicate that implements a logical NOT of the predicate passed to it.
|
||||
func Not(predicate Predicate) Predicate {
|
||||
return not{predicate}
|
||||
}
|
||||
|
||||
type not struct {
|
||||
predicate Predicate
|
||||
}
|
||||
|
||||
func (n not) InjectFunc(f inject.Func) error {
|
||||
return f(n.predicate)
|
||||
}
|
||||
|
||||
func (n not) Create(e event.CreateEvent) bool {
|
||||
return !n.predicate.Create(e)
|
||||
}
|
||||
|
||||
func (n not) Update(e event.UpdateEvent) bool {
|
||||
return !n.predicate.Update(e)
|
||||
}
|
||||
|
||||
func (n not) Delete(e event.DeleteEvent) bool {
|
||||
return !n.predicate.Delete(e)
|
||||
}
|
||||
|
||||
func (n not) Generic(e event.GenericEvent) bool {
|
||||
return !n.predicate.Generic(e)
|
||||
}
|
||||
|
||||
// LabelSelectorPredicate constructs a Predicate from a LabelSelector.
|
||||
// Only objects matching the LabelSelector will be admitted.
|
||||
func LabelSelectorPredicate(s metav1.LabelSelector) (Predicate, error) {
|
||||
|
||||
Reference in New Issue
Block a user