mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Merge pull request #72632 from danielqsj/sch_pod
Move getNextPod to closure
This commit is contained in:
@@ -811,3 +811,17 @@ func newNominatedPodMap() *nominatedPodMap {
|
||||
nominatedPodToNode: make(map[ktypes.UID]string),
|
||||
}
|
||||
}
|
||||
|
||||
// MakeNextPodFunc returns a function to retrieve the next pod from a given
|
||||
// scheduling queue
|
||||
func MakeNextPodFunc(queue SchedulingQueue) func() *v1.Pod {
|
||||
return func() *v1.Pod {
|
||||
pod, err := queue.Pop()
|
||||
if err == nil {
|
||||
klog.V(4).Infof("About to try and schedule pod %v/%v", pod.Namespace, pod.Name)
|
||||
return pod
|
||||
}
|
||||
klog.Errorf("Error while retrieving next pod from scheduling queue: %v", err)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user