Clean shutdown of kcm, ccm and scheduler
This commit is contained in:
@@ -335,7 +335,16 @@ func New(client clientset.Interface,
|
||||
// Run begins watching and scheduling. It starts scheduling and blocked until the context is done.
|
||||
func (sched *Scheduler) Run(ctx context.Context) {
|
||||
sched.SchedulingQueue.Run()
|
||||
wait.UntilWithContext(ctx, sched.scheduleOne, 0)
|
||||
|
||||
// We need to start scheduleOne loop in a dedicated goroutine,
|
||||
// because scheduleOne function hangs on getting the next item
|
||||
// from the SchedulingQueue.
|
||||
// If there are no new pods to schedule, it will be hanging there
|
||||
// and if done in this goroutine it will be blocking closing
|
||||
// SchedulingQueue, in effect causing a deadlock on shutdown.
|
||||
go wait.UntilWithContext(ctx, sched.scheduleOne, 0)
|
||||
|
||||
<-ctx.Done()
|
||||
sched.SchedulingQueue.Close()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user