Skip to content

Commit 170c7d8

Browse files
dlipovetskyjoejulian
authored andcommitted
📖 Improve docs for manager.Options.SyncPeriod (kubernetes-sigs#1232)
* Improve docs for manager.Options.SyncPeriod The comment tries to capture more of the thoughts exchanged in kubernetes-sigs#88. * Note that SyncPeriod applies to all controllers. Co-authored-by: Joe Julian <[email protected]> * Make explanation of SyncPeriod more precise.. Co-authored-by: Joe Julian <[email protected]> Co-authored-by: Joe Julian <[email protected]>
1 parent 311a44e commit 170c7d8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/manager/manager.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ type Options struct {
111111
// value only if you know what you are doing. Defaults to 10 hours if unset.
112112
// there will a 10 percent jitter between the SyncPeriod of all controllers
113113
// so that all controllers will not send list requests simultaneously.
114+
//
115+
// This applies to all controllers.
116+
//
117+
// A period sync happens for two reasons:
118+
// 1. To insure against a bug in the controller that causes an object to not
119+
// be requeued, when it otherwise should be requeued.
120+
// 2. To insure against an unknown bug in controller-runtime, or its dependencies,
121+
// that causes an object to not be requeued, when it otherwise should be
122+
// requeued, or to be removed from the queue, when it otherwise should not
123+
// be removed.
124+
//
125+
// If you want
126+
// 1. to insure against missed watch events, or
127+
// 2. to poll services that cannot be watched,
128+
// then we recommend that, instead of changing the default period, the
129+
// controller requeue, with a constant duration `t`, whenever the controller
130+
// is "done" with an object, and would otherwise not requeue it, i.e., we
131+
// recommend the `Reconcile` function return `reconcile.Result{RequeueAfter: t}`,
132+
// instead of `reconcile.Result{}`.
114133
SyncPeriod *time.Duration
115134

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

0 commit comments

Comments
 (0)