@@ -149,7 +149,7 @@ func (gc *GarbageCollector) Run(ctx context.Context, workers int, initialSyncTim
149
149
if ! cache .WaitForNamedCacheSync ("garbage collector" , waitForStopOrTimeout (ctx .Done (), initialSyncTimeout ), func () bool {
150
150
return gc .dependencyGraphBuilder .IsSynced (logger )
151
151
}) {
152
- logger .Info ("Garbage collector: all resource monitors could not be synced, proceeding anyways" )
152
+ logger .Info ("Garbage collector: not all resource monitors could be synced, proceeding anyways" )
153
153
} else {
154
154
logger .Info ("Garbage collector: all resource monitors have synced" )
155
155
}
@@ -227,14 +227,13 @@ func (gc *GarbageCollector) Sync(ctx context.Context, discoveryClient discovery.
227
227
}
228
228
logger .V (4 ).Info ("resynced monitors" )
229
229
230
- // wait for caches to fill for a while (our sync period) before attempting to rediscover resources and retry syncing.
231
- // this protects us from deadlocks where available resources changed and one of our informer caches will never fill.
232
- // informers keep attempting to sync in the background, so retrying doesn't interrupt them.
233
- // the call to resyncMonitors on the reattempt will no-op for resources that still exist.
234
- // note that workers stay paused until we successfully resync.
235
- if ! cache .WaitForNamedCacheSync ("garbage collector" , waitForStopOrTimeout (ctx .Done (), period ), func () bool {
230
+ // gc worker no longer waits for cache to be synced, but we will keep the periodical check to provide logs & metrics
231
+ cacheSynced := cache .WaitForNamedCacheSync ("garbage collector" , waitForStopOrTimeout (ctx .Done (), period ), func () bool {
236
232
return gc .dependencyGraphBuilder .IsSynced (logger )
237
- }) {
233
+ })
234
+ if cacheSynced {
235
+ logger .V (2 ).Info ("synced garbage collector" )
236
+ } else {
238
237
utilruntime .HandleError (fmt .Errorf ("timed out waiting for dependency graph builder sync during GC sync" ))
239
238
metrics .GarbageCollectorResourcesSyncError .Inc ()
240
239
}
@@ -243,7 +242,6 @@ func (gc *GarbageCollector) Sync(ctx context.Context, discoveryClient discovery.
243
242
// Monitors where the cache sync times out are still tracked here as
244
243
// subsequent runs should stop them if their resources were removed.
245
244
oldResources = newResources
246
- logger .V (2 ).Info ("synced garbage collector" )
247
245
}, period )
248
246
}
249
247
0 commit comments