Skip to content

Commit ef1b991

Browse files
committed
SchedulerPredicates [Serial] validates resource limits of pods that are allowed to run - set resource requests as well
NodeResourceFit plugin's Filter method responsible for checking if a pod fits a given node ignores resource limits and acknowledge resource requests only. Given both tests validating resource limits of pods were setting only pod resource limits, ability of NodeResourceFit plugin to properly filter nodes was not tested at all.
1 parent c5982d0 commit ef1b991

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/e2e/scheduling/predicates.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package scheduling
1818

1919
import (
2020
"fmt"
21-
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
2221
"time"
2322

2423
v1 "k8s.io/api/core/v1"
@@ -28,6 +27,7 @@ import (
2827
"k8s.io/apimachinery/pkg/util/uuid"
2928
utilversion "k8s.io/apimachinery/pkg/util/version"
3029
clientset "k8s.io/client-go/kubernetes"
30+
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
3131
"k8s.io/kubernetes/test/e2e/framework"
3232
e2eevents "k8s.io/kubernetes/test/e2e/framework/events"
3333
e2ekubelet "k8s.io/kubernetes/test/e2e/framework/kubelet"
@@ -116,7 +116,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
116116

117117
})
118118

119-
// This test verifies we don't allow scheduling of pods in a way that sum of local ephemeral storage limits of pods is greater than machines capacity.
119+
// This test verifies we don't allow scheduling of pods in a way that sum of local ephemeral storage resource requests of pods is greater than machines capacity.
120120
// It assumes that cluster add-on pods stay stable and cannot be run in parallel with any other test that touches Nodes or Pods.
121121
// It is so because we need to have precise control on what's running in the cluster.
122122
ginkgo.It("validates local ephemeral storage resource limits of pods that are allowed to run [Feature:LocalStorageCapacityIsolation]", func() {
@@ -186,14 +186,17 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
186186
Limits: v1.ResourceList{
187187
v1.ResourceEphemeralStorage: *resource.NewQuantity(ephemeralStoragePerPod, "DecimalSI"),
188188
},
189+
Requests: v1.ResourceList{
190+
v1.ResourceEphemeralStorage: *resource.NewQuantity(ephemeralStoragePerPod, "DecimalSI"),
191+
},
189192
},
190193
}
191194
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
192195
verifyResult(cs, podsNeededForSaturation, 1, ns)
193196
})
194197

195198
// This test verifies we don't allow scheduling of pods in a way that sum of
196-
// limits of pods is greater than machines capacity.
199+
// resource requests of pods is greater than machines capacity.
197200
// It assumes that cluster add-on pods stay stable and cannot be run in parallel
198201
// with any other test that touches Nodes or Pods.
199202
// It is so because we need to have precise control on what's running in the cluster.
@@ -206,7 +209,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
206209
/*
207210
Release : v1.9
208211
Testname: Scheduler, resource limits
209-
Description: Scheduling Pods MUST fail if the resource limits exceed Machine capacity.
212+
Description: Scheduling Pods MUST fail if the resource requests exceed Machine capacity.
210213
*/
211214
framework.ConformanceIt("validates resource limits of pods that are allowed to run ", func() {
212215
WaitForStableCluster(cs, masterNodes)
@@ -302,6 +305,9 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
302305
Limits: v1.ResourceList{
303306
v1.ResourceCPU: *resource.NewMilliQuantity(nodeMaxAllocatable*5/10, "DecimalSI"),
304307
},
308+
Requests: v1.ResourceList{
309+
v1.ResourceCPU: *resource.NewMilliQuantity(nodeMaxAllocatable*5/10, "DecimalSI"),
310+
},
305311
},
306312
}
307313
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)

0 commit comments

Comments
 (0)