mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #18416 from xiang90/r_scheduler
Auto commit by PR queue bot
This commit is contained in:
commit
2c89a8d16d
@ -63,6 +63,9 @@ type genericScheduler struct {
|
|||||||
randomLock sync.Mutex
|
randomLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Schedule tries to schedule the given pod to one of node in the node list.
|
||||||
|
// If it succeeds, it will return the name of the node.
|
||||||
|
// If it fails, it will return a Fiterror error with reasons.
|
||||||
func (g *genericScheduler) Schedule(pod *api.Pod, nodeLister algorithm.NodeLister) (string, error) {
|
func (g *genericScheduler) Schedule(pod *api.Pod, nodeLister algorithm.NodeLister) (string, error) {
|
||||||
nodes, err := nodeLister.List()
|
nodes, err := nodeLister.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -84,17 +87,18 @@ func (g *genericScheduler) Schedule(pod *api.Pod, nodeLister algorithm.NodeListe
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
priorityList, err := PrioritizeNodes(pod, machinesToPods, g.pods, g.prioritizers, algorithm.FakeNodeLister(filteredNodes), g.extenders)
|
if len(filteredNodes.Items) == 0 {
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if len(priorityList) == 0 {
|
|
||||||
return "", &FitError{
|
return "", &FitError{
|
||||||
Pod: pod,
|
Pod: pod,
|
||||||
FailedPredicates: failedPredicateMap,
|
FailedPredicates: failedPredicateMap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priorityList, err := PrioritizeNodes(pod, machinesToPods, g.pods, g.prioritizers, algorithm.FakeNodeLister(filteredNodes), g.extenders)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
return g.selectHost(priorityList)
|
return g.selectHost(priorityList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user