Merge pull request #98699 from damemi/balance-nodes-scheduling-ubernetes-lite

Balance nodes in scheduling e2e
This commit is contained in:
Kubernetes Prow Robot 2021-02-05 07:28:52 -08:00 committed by GitHub
commit c9604bd302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ import (
"context" "context"
"fmt" "fmt"
"math" "math"
"time"
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"github.com/onsi/gomega" "github.com/onsi/gomega"
@ -42,6 +43,7 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() {
f := framework.NewDefaultFramework("multi-az") f := framework.NewDefaultFramework("multi-az")
var zoneCount int var zoneCount int
var err error var err error
var cleanUp func()
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
e2eskipper.SkipUnlessProviderIs("gce", "gke", "aws") e2eskipper.SkipUnlessProviderIs("gce", "gke", "aws")
if zoneCount <= 0 { if zoneCount <= 0 {
@ -52,6 +54,20 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() {
msg := fmt.Sprintf("Zone count is %d, only run for multi-zone clusters, skipping test", zoneCount) msg := fmt.Sprintf("Zone count is %d, only run for multi-zone clusters, skipping test", zoneCount)
e2eskipper.SkipUnlessAtLeast(zoneCount, 2, msg) e2eskipper.SkipUnlessAtLeast(zoneCount, 2, msg)
// TODO: SkipUnlessDefaultScheduler() // Non-default schedulers might not spread // TODO: SkipUnlessDefaultScheduler() // Non-default schedulers might not spread
cs := f.ClientSet
e2enode.WaitForTotalHealthy(cs, time.Minute)
nodeList, err := e2enode.GetReadySchedulableNodes(cs)
framework.ExpectNoError(err)
// make the nodes have balanced cpu,mem usage
cleanUp, err = createBalancedPodForNodes(f, cs, f.Namespace.Name, nodeList.Items, podRequestedResource, 0.0)
framework.ExpectNoError(err)
})
ginkgo.AfterEach(func() {
if cleanUp != nil {
cleanUp()
}
}) })
ginkgo.It("should spread the pods of a service across zones", func() { ginkgo.It("should spread the pods of a service across zones", func() {
SpreadServiceOrFail(f, 5*zoneCount, imageutils.GetPauseImageName()) SpreadServiceOrFail(f, 5*zoneCount, imageutils.GetPauseImageName())