mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #29550 from caesarxuchao/fix-28713
Automatic merge from submit-queue [Garbage Collector] GC waits for all reflectors to be synced before starting workers Fix 28713. See https://github.com/kubernetes/kubernetes/issues/28713#issuecomment-234826276 for details on the cause of the flake. The test has passed 100 times locally.
This commit is contained in:
commit
a4442250f3
@ -685,10 +685,22 @@ func (gc *GarbageCollector) processItem(item *node) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gc *GarbageCollector) Run(workers int, stopCh <-chan struct{}) {
|
func (gc *GarbageCollector) Run(workers int, stopCh <-chan struct{}) {
|
||||||
|
glog.Infof("Garbage Collector: Initializing")
|
||||||
for _, monitor := range gc.monitors {
|
for _, monitor := range gc.monitors {
|
||||||
go monitor.controller.Run(stopCh)
|
go monitor.controller.Run(stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait.PollInfinite(10*time.Second, func() (bool, error) {
|
||||||
|
for _, monitor := range gc.monitors {
|
||||||
|
if !monitor.controller.HasSynced() {
|
||||||
|
glog.Infof("Garbage Collector: Waiting for resource monitors to be synced...")
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
glog.Infof("Garbage Collector: All monitored resources synced. Proceeding to collect garbage")
|
||||||
|
|
||||||
// worker
|
// worker
|
||||||
go wait.Until(gc.propagator.processEvent, 0, stopCh)
|
go wait.Until(gc.propagator.processEvent, 0, stopCh)
|
||||||
|
|
||||||
@ -697,7 +709,7 @@ func (gc *GarbageCollector) Run(workers int, stopCh <-chan struct{}) {
|
|||||||
go wait.Until(gc.orphanFinalizer, 0, stopCh)
|
go wait.Until(gc.orphanFinalizer, 0, stopCh)
|
||||||
}
|
}
|
||||||
<-stopCh
|
<-stopCh
|
||||||
glog.Infof("Shutting down garbage collector")
|
glog.Infof("Garbage Collector: Shutting down")
|
||||||
gc.dirtyQueue.ShutDown()
|
gc.dirtyQueue.ShutDown()
|
||||||
gc.orphanQueue.ShutDown()
|
gc.orphanQueue.ShutDown()
|
||||||
gc.propagator.eventQueue.ShutDown()
|
gc.propagator.eventQueue.ShutDown()
|
||||||
|
Loading…
Reference in New Issue
Block a user