Skip to content

Commit 897454a

Browse files
committed
📖 Docs for SyncPeriod: No sync from api-server.
1 parent e4f9a24 commit 897454a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pkg/cache/cache.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,14 @@ type Options struct {
173173
// recommend the `Reconcile` function return `reconcile.Result{RequeueAfter: t}`,
174174
// instead of `reconcile.Result{}`.
175175
//
176-
// SyncPeriod will trigger update events with the old object being equal to the new
177-
// object, except when the cache was out of sync.
178-
// If you filter update events like this:
179-
// Controller.Watch(
180-
// &source.Kind{Type: v1.MyCustomKind},
181-
// &handler.EnqueueRequestForObject{},
182-
// predicate.Or(predicate.GenerationChangedPredicate{},
183-
// predicate.LabelChangedPredicate{}))
184-
// then the SyncPeriod will not trigger a Reconcile call, because the update event
185-
// will be ignored by the predicate.
176+
// SyncPeriod will locally trigger an artificial Update event with the same
177+
// object in both ObjectOld and ObjectNew for everything that is in the
178+
// cache.
179+
//
180+
// Predicates or Handlers that expect ObjectOld and ObjectNew to be different
181+
// (such as GenerationChangedPredicate) will filter out this event, preventing
182+
// it from triggering a reconciliation.
183+
// SyncPeriod does not sync between the local cache and the server.
186184
SyncPeriod *time.Duration
187185

188186
// ReaderFailOnMissingInformer configures the cache to return a ErrResourceNotCached error when a user

0 commit comments

Comments
 (0)