@@ -69,7 +69,8 @@ var ErrClusterLocked = errors.New("cluster is locked already")
69
69
type ClusterCacheTracker struct {
70
70
log logr.Logger
71
71
72
- cacheByObject map [client.Object ]cache.ByObject
72
+ cacheByObject map [client.Object ]cache.ByObject
73
+ cacheSyncPeriod * time.Duration
73
74
74
75
clientUncachedObjects []client.Object
75
76
clientQPS float32
@@ -120,6 +121,9 @@ type ClusterCacheTrackerOptions struct {
120
121
// CacheByObject restricts the cache's ListWatch to the desired fields per GVK at the specified object.
121
122
CacheByObject map [client.Object ]cache.ByObject
122
123
124
+ // CacheSyncPeriod is the syncPeriod used by the remote cluster cache.
125
+ CacheSyncPeriod * time.Duration
126
+
123
127
// ClientUncachedObjects instructs the Client to never cache the following objects,
124
128
// it'll instead query the API server directly.
125
129
// Defaults to never caching ConfigMap and Secret if not set.
@@ -197,6 +201,7 @@ func NewClusterCacheTracker(manager ctrl.Manager, options ClusterCacheTrackerOpt
197
201
log : * options .Log ,
198
202
clientUncachedObjects : options .ClientUncachedObjects ,
199
203
cacheByObject : options .CacheByObject ,
204
+ cacheSyncPeriod : options .CacheSyncPeriod ,
200
205
clientQPS : options .ClientQPS ,
201
206
clientBurst : options .ClientBurst ,
202
207
client : manager .GetClient (),
@@ -492,6 +497,7 @@ func (t *ClusterCacheTracker) createCachedClient(ctx context.Context, config *re
492
497
Scheme : t .scheme ,
493
498
Mapper : mapper ,
494
499
ByObject : t .cacheByObject ,
500
+ SyncPeriod : t .cacheSyncPeriod ,
495
501
}
496
502
remoteCache , err := cache .New (config , cacheOptions )
497
503
if err != nil {
0 commit comments