mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
base on allNodes when calculating nextStartNodeIndex
This commit is contained in:
parent
a7f95d39e0
commit
f73bb17efb
@ -502,7 +502,7 @@ func (sched *Scheduler) findNodesThatFitPod(ctx context.Context, fwk framework.F
|
|||||||
// always try to update the sched.nextStartNodeIndex regardless of whether an error has occurred
|
// always try to update the sched.nextStartNodeIndex regardless of whether an error has occurred
|
||||||
// this is helpful to make sure that all the nodes have a chance to be searched
|
// this is helpful to make sure that all the nodes have a chance to be searched
|
||||||
processedNodes := len(feasibleNodes) + len(diagnosis.NodeToStatusMap)
|
processedNodes := len(feasibleNodes) + len(diagnosis.NodeToStatusMap)
|
||||||
sched.nextStartNodeIndex = (sched.nextStartNodeIndex + processedNodes) % len(nodes)
|
sched.nextStartNodeIndex = (sched.nextStartNodeIndex + processedNodes) % len(allNodes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, diagnosis, err
|
return nil, diagnosis, err
|
||||||
}
|
}
|
||||||
|
@ -2416,6 +2416,33 @@ func TestSchedulerSchedulePod(t *testing.T) {
|
|||||||
wantNodes: sets.New("node1", "node2"),
|
wantNodes: sets.New("node1", "node2"),
|
||||||
wantEvaluatedNodes: ptr.To[int32](2),
|
wantEvaluatedNodes: ptr.To[int32](2),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test prefilter plugin returned an invalid node",
|
||||||
|
registerPlugins: []tf.RegisterPluginFunc{
|
||||||
|
tf.RegisterQueueSortPlugin(queuesort.Name, queuesort.New),
|
||||||
|
tf.RegisterPreFilterPlugin(
|
||||||
|
"FakePreFilter",
|
||||||
|
tf.NewFakePreFilterPlugin("FakePreFilter", &framework.PreFilterResult{
|
||||||
|
NodeNames: sets.New("invalid-node"),
|
||||||
|
}, nil),
|
||||||
|
),
|
||||||
|
tf.RegisterFilterPlugin("TrueFilter", tf.NewTrueFilterPlugin),
|
||||||
|
tf.RegisterBindPlugin(defaultbinder.Name, defaultbinder.New),
|
||||||
|
},
|
||||||
|
nodes: []string{"1", "2"},
|
||||||
|
pod: st.MakePod().Name("test-prefilter").UID("test-prefilter").Obj(),
|
||||||
|
wantNodes: nil,
|
||||||
|
wErr: &framework.FitError{
|
||||||
|
Pod: st.MakePod().Name("test-prefilter").UID("test-prefilter").Obj(),
|
||||||
|
NumAllNodes: 2,
|
||||||
|
Diagnosis: framework.Diagnosis{
|
||||||
|
NodeToStatusMap: framework.NodeToStatusMap{
|
||||||
|
"1": framework.NewStatus(framework.UnschedulableAndUnresolvable, "node is filtered out by the prefilter result"),
|
||||||
|
"2": framework.NewStatus(framework.UnschedulableAndUnresolvable, "node is filtered out by the prefilter result"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user