Skip to content

Commit 38e11f8

Browse files
committed
Rename manager.Resync to SyncPeriod
SyncPeriod is the name most frequently used for this option by Kubernetes controllers. Also added more docs on how to choose a value.
1 parent b3ceb99 commit 38e11f8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pkg/cache/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type Options struct {
7777
// Mapper is the RESTMapper to use for mapping GroupVersionKinds to Resources
7878
Mapper meta.RESTMapper
7979

80-
// Resync is the resync interval. Defaults to defaultResyncTime.
80+
// Resync is the resync period. Defaults to defaultResyncTime.
8181
Resync *time.Duration
8282
}
8383

pkg/manager/manager.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,13 @@ type Options struct {
7676
// MapperProvider provides the rest mapper used to map go types to Kubernetes APIs
7777
MapperProvider func(c *rest.Config) (meta.RESTMapper, error)
7878

79-
// Resync is the cache resync interval. Defaults to the cache default if unset.
80-
Resync *time.Duration
79+
// SyncPeriod determines the minimum frequency at which watched objects are
80+
// reconciled. A lower period will correct entropy more quickly but reduce
81+
// responsiveness to change. Choose a low value if reconciles are fast and/or
82+
// there are few objects to reconcile. Choose a high value if reconciles are
83+
// slow and/or there are many object to reconcile. Defaults to 10 hours if
84+
// unset.
85+
SyncPeriod *time.Duration
8186

8287
// Dependency injection for testing
8388
newCache func(config *rest.Config, opts cache.Options) (cache.Cache, error)
@@ -124,7 +129,7 @@ func New(config *rest.Config, options Options) (Manager, error) {
124129
}
125130

126131
// Create the cache for the cached read client and registering informers
127-
cache, err := options.newCache(config, cache.Options{Scheme: options.Scheme, Mapper: mapper, Resync: options.Resync})
132+
cache, err := options.newCache(config, cache.Options{Scheme: options.Scheme, Mapper: mapper, Resync: options.SyncPeriod})
128133
if err != nil {
129134
return nil, err
130135

0 commit comments

Comments
 (0)