Skip to content

Commit 09d49d4

Browse files
ykakarapk8s-infra-cherrypick-robot
authored and
k8s-infra-cherrypick-robot
committed
add cacheSyncPeriod option to ClusterCacheTracker
1 parent 1558c7a commit 09d49d4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controllers/remote/cluster_cache_tracker.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ var ErrClusterLocked = errors.New("cluster is locked already")
6969
type ClusterCacheTracker struct {
7070
log logr.Logger
7171

72-
cacheByObject map[client.Object]cache.ByObject
72+
cacheByObject map[client.Object]cache.ByObject
73+
cacheSyncPeriod *time.Duration
7374

7475
clientUncachedObjects []client.Object
7576
clientQPS float32
@@ -120,6 +121,9 @@ type ClusterCacheTrackerOptions struct {
120121
// CacheByObject restricts the cache's ListWatch to the desired fields per GVK at the specified object.
121122
CacheByObject map[client.Object]cache.ByObject
122123

124+
// CacheSyncPeriod is the syncPeriod used by the remote cluster cache.
125+
CacheSyncPeriod *time.Duration
126+
123127
// ClientUncachedObjects instructs the Client to never cache the following objects,
124128
// it'll instead query the API server directly.
125129
// Defaults to never caching ConfigMap and Secret if not set.
@@ -197,6 +201,7 @@ func NewClusterCacheTracker(manager ctrl.Manager, options ClusterCacheTrackerOpt
197201
log: *options.Log,
198202
clientUncachedObjects: options.ClientUncachedObjects,
199203
cacheByObject: options.CacheByObject,
204+
cacheSyncPeriod: options.CacheSyncPeriod,
200205
clientQPS: options.ClientQPS,
201206
clientBurst: options.ClientBurst,
202207
client: manager.GetClient(),
@@ -492,6 +497,7 @@ func (t *ClusterCacheTracker) createCachedClient(ctx context.Context, config *re
492497
Scheme: t.scheme,
493498
Mapper: mapper,
494499
ByObject: t.cacheByObject,
500+
SyncPeriod: t.cacheSyncPeriod,
495501
}
496502
remoteCache, err := cache.New(config, cacheOptions)
497503
if err != nil {

0 commit comments

Comments
 (0)