Skip to content

Commit 3b22fcc

Browse files
authored
Merge pull request kubernetes#88189 from skilxn-go/RemovePreScoreNodeListArguments
[Scheduler Framework]Remove `FilteredNodesStatuses` argument from `PreScore`'s interface
2 parents 1c60045 + 8fd0d80 commit 3b22fcc

File tree

17 files changed

+31
-37
lines changed

17 files changed

+31
-37
lines changed

pkg/scheduler/core/generic_scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (g *genericScheduler) Schedule(ctx context.Context, state *framework.CycleS
203203
}
204204

205205
// Run "prescore" plugins.
206-
prescoreStatus := g.framework.RunPreScorePlugins(ctx, state, pod, filteredNodes, filteredNodesStatuses)
206+
prescoreStatus := g.framework.RunPreScorePlugins(ctx, state, pod, filteredNodes)
207207
if !prescoreStatus.IsSuccess() {
208208
return result, prescoreStatus.AsError()
209209
}

pkg/scheduler/core/generic_scheduler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,11 @@ func TestZeroRequest(t *testing.T) {
11441144

11451145
ctx := context.Background()
11461146
state := framework.NewCycleState()
1147-
_, filteredNodesStatuses, err := scheduler.findNodesThatFitPod(ctx, state, test.pod)
1147+
_, _, err = scheduler.findNodesThatFitPod(ctx, state, test.pod)
11481148
if err != nil {
11491149
t.Fatalf("error filtering nodes: %+v", err)
11501150
}
1151-
scheduler.framework.RunPreScorePlugins(ctx, state, test.pod, test.nodes, filteredNodesStatuses)
1151+
scheduler.framework.RunPreScorePlugins(ctx, state, test.pod, test.nodes)
11521152
list, err := scheduler.prioritizeNodes(
11531153
ctx,
11541154
state,

pkg/scheduler/framework/plugins/defaultpodtopologyspread/default_pod_topology_spread.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package defaultpodtopologyspread
1919
import (
2020
"context"
2121
"fmt"
22+
2223
"k8s.io/klog"
2324

2425
v1 "k8s.io/api/core/v1"
@@ -178,7 +179,7 @@ func (pl *DefaultPodTopologySpread) ScoreExtensions() framework.ScoreExtensions
178179
}
179180

180181
// PreScore builds and writes cycle state used by Score and NormalizeScore.
181-
func (pl *DefaultPodTopologySpread) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*v1.Node, _ framework.NodeToStatusMap) *framework.Status {
182+
func (pl *DefaultPodTopologySpread) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*v1.Node) *framework.Status {
182183
var selector labels.Selector
183184
informerFactory := pl.handle.SharedInformerFactory()
184185
selector = getSelector(

pkg/scheduler/framework/plugins/defaultpodtopologyspread/default_pod_topology_spread_perf_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func BenchmarkTestSelectorSpreadPriority(b *testing.B) {
7373

7474
for i := 0; i < b.N; i++ {
7575
state := framework.NewCycleState()
76-
status := plugin.PreScore(ctx, state, pod, allNodes, nil)
76+
status := plugin.PreScore(ctx, state, pod, allNodes)
7777
if !status.IsSuccess() {
7878
b.Fatalf("unexpected error: %v", status)
7979
}

pkg/scheduler/framework/plugins/defaultpodtopologyspread/default_pod_topology_spread_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func TestDefaultPodTopologySpreadScore(t *testing.T) {
386386
handle: fh,
387387
}
388388

389-
status := plugin.PreScore(ctx, state, test.pod, nodes, nil)
389+
status := plugin.PreScore(ctx, state, test.pod, nodes)
390390
if !status.IsSuccess() {
391391
t.Fatalf("unexpected error: %v", status)
392392
}
@@ -638,7 +638,7 @@ func TestZoneSelectorSpreadPriority(t *testing.T) {
638638
}
639639

640640
state := framework.NewCycleState()
641-
status := plugin.PreScore(ctx, state, test.pod, nodes, nil)
641+
status := plugin.PreScore(ctx, state, test.pod, nodes)
642642
if !status.IsSuccess() {
643643
t.Fatalf("unexpected error: %v", status)
644644
}

pkg/scheduler/framework/plugins/interpodaffinity/scoring.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222

23-
"k8s.io/api/core/v1"
23+
v1 "k8s.io/api/core/v1"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525
"k8s.io/client-go/util/workqueue"
2626
"k8s.io/klog"
@@ -172,7 +172,6 @@ func (pl *InterPodAffinity) PreScore(
172172
cycleState *framework.CycleState,
173173
pod *v1.Pod,
174174
nodes []*v1.Node,
175-
_ framework.NodeToStatusMap,
176175
) *framework.Status {
177176
if len(nodes) == 0 {
178177
// No nodes to score.

pkg/scheduler/framework/plugins/interpodaffinity/scoring_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ func TestPreferredAffinity(t *testing.T) {
523523
hardPodAffinityWeight: 1,
524524
}
525525

526-
status := p.PreScore(context.Background(), state, test.pod, test.nodes, nil)
526+
status := p.PreScore(context.Background(), state, test.pod, test.nodes)
527527
if !status.IsSuccess() {
528528
t.Errorf("unexpected error: %v", status)
529529
}
@@ -631,7 +631,7 @@ func TestPreferredAffinityWithHardPodAffinitySymmetricWeight(t *testing.T) {
631631
if err != nil {
632632
t.Fatal(err)
633633
}
634-
status := p.(framework.PreScorePlugin).PreScore(context.Background(), state, test.pod, test.nodes, nil)
634+
status := p.(framework.PreScorePlugin).PreScore(context.Background(), state, test.pod, test.nodes)
635635
if !status.IsSuccess() {
636636
t.Errorf("unexpected error: %v", status)
637637
}

pkg/scheduler/framework/plugins/noderesources/resource_limits.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func (rl *ResourceLimits) PreScore(
6565
cycleState *framework.CycleState,
6666
pod *v1.Pod,
6767
nodes []*v1.Node,
68-
_ framework.NodeToStatusMap,
6968
) *framework.Status {
7069
if len(nodes) == 0 {
7170
// No nodes to score.

pkg/scheduler/framework/plugins/noderesources/resource_limits_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestResourceLimits(t *testing.T) {
152152
for i := range test.nodes {
153153
state := framework.NewCycleState()
154154
if !test.skipPreScore {
155-
status := p.PreScore(context.Background(), state, test.pod, test.nodes, nil)
155+
status := p.PreScore(context.Background(), state, test.pod, test.nodes)
156156
if !status.IsSuccess() {
157157
t.Errorf("unexpected error: %v", status)
158158
}

pkg/scheduler/framework/plugins/podtopologyspread/scoring.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ func (pl *PodTopologySpread) PreScore(
8484
cycleState *framework.CycleState,
8585
pod *v1.Pod,
8686
filteredNodes []*v1.Node,
87-
_ framework.NodeToStatusMap,
8887
) *framework.Status {
8988
allNodes, err := pl.sharedLister.NodeInfos().List()
9089
if err != nil {

0 commit comments

Comments
 (0)