Skip to content

Commit 252af64

Browse files
authored
Merge pull request #3254 from guettli/fix-docs-for-LabelChangedPredicate
📖 Fix docs for LabelChangedPredicate.
2 parents 4c2e9ce + 9539a08 commit 252af64

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pkg/predicate/predicate.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ type TypedPredicate[object any] interface {
4747
Generic(event.TypedGenericEvent[object]) bool
4848
}
4949

50-
var _ Predicate = Funcs{}
51-
var _ Predicate = ResourceVersionChangedPredicate{}
52-
var _ Predicate = GenerationChangedPredicate{}
53-
var _ Predicate = AnnotationChangedPredicate{}
54-
var _ Predicate = or[client.Object]{}
55-
var _ Predicate = and[client.Object]{}
56-
var _ Predicate = not[client.Object]{}
50+
var (
51+
_ Predicate = Funcs{}
52+
_ Predicate = ResourceVersionChangedPredicate{}
53+
_ Predicate = GenerationChangedPredicate{}
54+
_ Predicate = AnnotationChangedPredicate{}
55+
_ Predicate = or[client.Object]{}
56+
_ Predicate = and[client.Object]{}
57+
_ Predicate = not[client.Object]{}
58+
)
5759

5860
// Funcs is a function that implements Predicate.
5961
type Funcs = TypedFuncs[client.Object]
@@ -259,11 +261,10 @@ func (TypedAnnotationChangedPredicate[object]) Update(e event.TypedUpdateEvent[o
259261
// This predicate will skip update events that have no change in the object's label.
260262
// It is intended to be used in conjunction with the GenerationChangedPredicate, as in the following example:
261263
//
262-
// Controller.Watch(
263-
//
264-
// &source.Kind{Type: v1.MyCustomKind},
265-
// &handler.EnqueueRequestForObject{},
266-
// predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{}))
264+
// Controller.Watch(
265+
// &source.Kind{Type: v1.MyCustomKind},
266+
// &handler.EnqueueRequestForObject{},
267+
// predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{}))
267268
//
268269
// This will be helpful when object's labels is carrying some extra specification information beyond object's spec,
269270
// and the controller will be triggered if any valid spec change (not only in spec, but also in labels) happens.

0 commit comments

Comments
 (0)