Skip to content

Commit baf3d61

Browse files
committed
Improve docs for manager.Options.SyncPeriod
The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88.
1 parent d8385e3 commit baf3d61

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/manager/manager.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@ type Options struct {
139139
// value only if you know what you are doing. Defaults to 10 hours if unset.
140140
// there will a 10 percent jitter between the SyncPeriod of all controllers
141141
// so that all controllers will not send list requests simultaneously.
142+
//
143+
// A period sync happens for two reasons:
144+
// 1. To insure against a bug in the controller that causes an object to not
145+
// be requeued, when it otherwise should be requeued.
146+
// 2. To insure against a bug in controller-runtime, or its dependencies,
147+
// that causes an object to not be requeued, when it otherwise should be
148+
// requeued, or to be removed from the queue, when it otherwise should not
149+
// be removed.
150+
//
151+
// If you want
152+
// 1. to insure against missed watch events, or
153+
// 2. to poll services that cannot be watched,
154+
// then we recommend that, instead of changing the default period, the
155+
// controller requeue, with a constant duration `t`, whenever the controller
156+
// is "done" with an object, and would otherwise not requeue it, i.e., we
157+
// recommend the `Reconcile` function return `reconcile.Result{RequeueAfter: t}`,
158+
// instead of `reconcile.Result{}`.
142159
SyncPeriod *time.Duration
143160

144161
// Logger is the logger that should be used by this manager.

0 commit comments

Comments
 (0)