mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #94211 from soulxu/cleanup_candidates
Initialize candidate directly instead of iterating the array of candidates
This commit is contained in:
commit
9062c43b76
@ -332,13 +332,15 @@ func SelectCandidate(candidates []Candidate) Candidate {
|
||||
|
||||
// Same as candidatesToVictimsMap, this logic is not applicable for out-of-tree
|
||||
// preemption plugins that exercise different candidates on the same nominated node.
|
||||
for _, candidate := range candidates {
|
||||
if candidateNode == candidate.Name() {
|
||||
return candidate
|
||||
if victims := victimsMap[candidateNode]; victims != nil {
|
||||
return &candidate{
|
||||
victims: victims,
|
||||
name: candidateNode,
|
||||
}
|
||||
}
|
||||
|
||||
// We shouldn't reach here.
|
||||
klog.Errorf("None candidate can be picked from %v.", candidates)
|
||||
klog.Errorf("should not reach here, no candidate selected from %v.", candidates)
|
||||
// To not break the whole flow, return the first candidate.
|
||||
return candidates[0]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user