Merge pull request #87242 from ingvagabund/scheduler-predicates-set-resource-requests

SchedulerPredicates [Serial] validates resource limits of pods that are allowed to run - set resource requests as well
This commit is contained in:
Kubernetes Prow Robot 2020-02-07 18:32:42 -08:00 committed by GitHub
commit c5cb398826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,6 @@ package scheduling
import ( import (
"fmt" "fmt"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
"time" "time"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
@ -28,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/uuid"
utilversion "k8s.io/apimachinery/pkg/util/version" utilversion "k8s.io/apimachinery/pkg/util/version"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2eevents "k8s.io/kubernetes/test/e2e/framework/events" e2eevents "k8s.io/kubernetes/test/e2e/framework/events"
e2ekubelet "k8s.io/kubernetes/test/e2e/framework/kubelet" e2ekubelet "k8s.io/kubernetes/test/e2e/framework/kubelet"
@ -116,7 +116,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
}) })
// 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. // 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.
// It assumes that cluster add-on pods stay stable and cannot be run in parallel with any other test that touches Nodes or Pods. // It assumes that cluster add-on pods stay stable and cannot be run in parallel with any other test that touches Nodes or Pods.
// It is so because we need to have precise control on what's running in the cluster. // It is so because we need to have precise control on what's running in the cluster.
ginkgo.It("validates local ephemeral storage resource limits of pods that are allowed to run [Feature:LocalStorageCapacityIsolation]", func() { ginkgo.It("validates local ephemeral storage resource limits of pods that are allowed to run [Feature:LocalStorageCapacityIsolation]", func() {
@ -186,6 +186,9 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
Limits: v1.ResourceList{ Limits: v1.ResourceList{
v1.ResourceEphemeralStorage: *resource.NewQuantity(ephemeralStoragePerPod, "DecimalSI"), v1.ResourceEphemeralStorage: *resource.NewQuantity(ephemeralStoragePerPod, "DecimalSI"),
}, },
Requests: v1.ResourceList{
v1.ResourceEphemeralStorage: *resource.NewQuantity(ephemeralStoragePerPod, "DecimalSI"),
},
}, },
} }
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false) WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)
@ -193,7 +196,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
}) })
// This test verifies we don't allow scheduling of pods in a way that sum of // This test verifies we don't allow scheduling of pods in a way that sum of
// limits of pods is greater than machines capacity. // resource requests of pods is greater than machines capacity.
// It assumes that cluster add-on pods stay stable and cannot be run in parallel // It assumes that cluster add-on pods stay stable and cannot be run in parallel
// with any other test that touches Nodes or Pods. // with any other test that touches Nodes or Pods.
// It is so because we need to have precise control on what's running in the cluster. // 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() {
/* /*
Release : v1.9 Release : v1.9
Testname: Scheduler, resource limits Testname: Scheduler, resource limits
Description: Scheduling Pods MUST fail if the resource limits exceed Machine capacity. Description: Scheduling Pods MUST fail if the resource requests exceed Machine capacity.
*/ */
framework.ConformanceIt("validates resource limits of pods that are allowed to run ", func() { framework.ConformanceIt("validates resource limits of pods that are allowed to run ", func() {
WaitForStableCluster(cs, masterNodes) WaitForStableCluster(cs, masterNodes)
@ -302,6 +305,9 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
Limits: v1.ResourceList{ Limits: v1.ResourceList{
v1.ResourceCPU: *resource.NewMilliQuantity(nodeMaxAllocatable*5/10, "DecimalSI"), v1.ResourceCPU: *resource.NewMilliQuantity(nodeMaxAllocatable*5/10, "DecimalSI"),
}, },
Requests: v1.ResourceList{
v1.ResourceCPU: *resource.NewMilliQuantity(nodeMaxAllocatable*5/10, "DecimalSI"),
},
}, },
} }
WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false) WaitForSchedulerAfterAction(f, createPausePodAction(f, conf), ns, podName, false)