Dequeue pods in scheduler which are terminating

This commit is contained in:
Dr. Stefan Schimanski
2015-09-17 13:50:32 +02:00
parent 09cf38e9a8
commit e4dcd97ac3
2 changed files with 11 additions and 1 deletions

View File

@@ -438,7 +438,12 @@ func (q *queuer) Run(done <-chan struct{}) {
pod := p.(*Pod)
if recoverAssignedSlave(pod.Pod) != "" {
log.V(3).Infof("dequeuing pod for scheduling: %v", pod.Pod.Name)
log.V(3).Infof("dequeuing assigned pod for scheduling: %v", pod.Pod.Name)
q.dequeue(pod.GetUID())
} else if pod.InGracefulTermination() {
// pods which are pre-scheduled (i.e. NodeName is set) may be gracefully deleted,
// even though they are not running yet.
log.V(3).Infof("dequeuing graceful deleted pre-scheduled pod for scheduling: %v", pod.Pod.Name)
q.dequeue(pod.GetUID())
} else {
// use ReplaceExisting because we are always pushing the latest state

View File

@@ -78,3 +78,8 @@ func (p *Pod) String() string {
}
return fmt.Sprintf("{pod:%v, deadline:%v, delay:%v}", p.Pod.Name, displayDeadline, p.GetDelay())
}
func (p *Pod) InGracefulTermination() bool {
return p.Pod.DeletionTimestamp != nil &&
p.Pod.DeletionGracePeriodSeconds != nil && *p.Pod.DeletionGracePeriodSeconds > 0
}