scheduler(NodeResourcesFit & NodeResourcesBalancedAllocation): calculatePodResourceRequest in PreScore phase (#115655)

* scheduler(NodeResourcesFit): calculatePodResourceRequest in PreScore phase

* scheduler(NodeResourcesFit and NodeResourcesBalancedAllocation): calculatePodResourceRequest in PreScore phase

* modify the comments and tests.

* revert the tests.

* don't need consider nodes.

* use list instead of map.

* add comment for podRequests.

* avoid using negative wording in variable names.
This commit is contained in:
tangwz
2023-03-10 23:44:53 +08:00
committed by GitHub
parent 2e3c5003b9
commit be080584c6
13 changed files with 286 additions and 22 deletions

View File

@@ -407,11 +407,16 @@ func TestLeastAllocatedScoringStrategy(t *testing.T) {
return
}
status := p.(framework.PreScorePlugin).PreScore(ctx, state, test.requestedPod, test.nodes)
if !status.IsSuccess() {
t.Errorf("PreScore is expected to return success, but didn't. Got status: %v", status)
}
var gotScores framework.NodeScoreList
for _, n := range test.nodes {
score, status := p.(framework.ScorePlugin).Score(ctx, state, test.requestedPod, n.Name)
if status.Code() != test.wantStatusCode {
t.Errorf("unexpected status code, want: %v, got: %v", test.wantStatusCode, status)
t.Errorf("unexpected status code, want: %v, got: %v", test.wantStatusCode, status.Code())
}
gotScores = append(gotScores, framework.NodeScore{Name: n.Name, Score: score})
}