mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Refactor selectHost in generic_scheduler
This commit is contained in:
parent
3b1ef739d1
commit
415ac3bf8a
@ -49,10 +49,10 @@ func (g *genericScheduler) Schedule(pod api.Pod, minionLister MinionLister) (str
|
||||
if len(priorityList) == 0 {
|
||||
return "", fmt.Errorf("failed to find a fit for pod: %v", pod)
|
||||
}
|
||||
return g.selectHost(priorityList)
|
||||
return g.selectHost(priorityList), nil
|
||||
}
|
||||
|
||||
func (g *genericScheduler) selectHost(priorityList HostPriorityList) (string, error) {
|
||||
func (g *genericScheduler) selectHost(priorityList HostPriorityList) string {
|
||||
sort.Sort(priorityList)
|
||||
|
||||
hosts := getMinHosts(priorityList)
|
||||
@ -60,7 +60,7 @@ func (g *genericScheduler) selectHost(priorityList HostPriorityList) (string, er
|
||||
defer g.randomLock.Unlock()
|
||||
|
||||
ix := g.random.Int() % len(hosts)
|
||||
return hosts[ix], nil
|
||||
return hosts[ix]
|
||||
}
|
||||
|
||||
func findNodesThatFit(pod api.Pod, podLister PodLister, predicates []FitPredicate, nodes api.MinionList) (api.MinionList, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user