- Add Extenders() and PluginsRunner interface to PreemptHandle

- Make some private functions stateless
  - make addNominatedPods() not dependent on genericScheduler
  - make addNominatedPods() not dependent on genericScheduler
  - make selectVictimsOnNode() not dependent on genericScheduler
  - make selectNodesForPreemption() not dependent on genericScheduler
This commit is contained in:
Wei Huang
2020-04-23 17:08:59 -07:00
parent 3a95b1130a
commit 59eff29d22
5 changed files with 70 additions and 23 deletions

View File

@@ -1632,7 +1632,7 @@ func TestSelectNodesForPreemption(t *testing.T) {
if err != nil {
t.Fatal(err)
}
nodeToPods, err := g.selectNodesForPreemption(context.Background(), prof, state, test.pod, nodeInfos, test.pdbs)
nodeToPods, err := selectNodesForPreemption(context.Background(), prof, g.podNominator, state, test.pod, nodeInfos, test.pdbs)
if err != nil {
t.Error(err)
}
@@ -1912,7 +1912,7 @@ func TestPickOneNodeForPreemption(t *testing.T) {
if !preFilterStatus.IsSuccess() {
t.Errorf("Unexpected preFilterStatus: %v", preFilterStatus)
}
candidateNodes, _ := g.selectNodesForPreemption(context.Background(), prof, state, test.pod, nodeInfos, nil)
candidateNodes, _ := selectNodesForPreemption(context.Background(), prof, g.podNominator, state, test.pod, nodeInfos, nil)
node := pickOneNodeForPreemption(candidateNodes)
found := false
for _, nodeName := range test.expected {