Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2927f04

Browse files
committed
Balance nodes in scheduling e2e
This adds a call to createBalancedPods during the ubernetes_lite scheduling e2es, which are prone to improper score balancing due to unbalanced utilization.
1 parent 1598f8b commit 2927f04

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/e2e/scheduling/ubernetes_lite.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"math"
23+
"time"
2324

2425
"github.com/onsi/ginkgo"
2526
"github.com/onsi/gomega"
@@ -42,6 +43,7 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() {
4243
f := framework.NewDefaultFramework("multi-az")
4344
var zoneCount int
4445
var err error
46+
var cleanUp func()
4547
ginkgo.BeforeEach(func() {
4648
e2eskipper.SkipUnlessProviderIs("gce", "gke", "aws")
4749
if zoneCount <= 0 {
@@ -52,6 +54,20 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() {
5254
msg := fmt.Sprintf("Zone count is %d, only run for multi-zone clusters, skipping test", zoneCount)
5355
e2eskipper.SkipUnlessAtLeast(zoneCount, 2, msg)
5456
// TODO: SkipUnlessDefaultScheduler() // Non-default schedulers might not spread
57+
58+
cs := f.ClientSet
59+
e2enode.WaitForTotalHealthy(cs, time.Minute)
60+
nodeList, err := e2enode.GetReadySchedulableNodes(cs)
61+
framework.ExpectNoError(err)
62+
63+
// make the nodes have balanced cpu,mem usage
64+
cleanUp, err = createBalancedPodForNodes(f, cs, f.Namespace.Name, nodeList.Items, podRequestedResource, 0.0)
65+
framework.ExpectNoError(err)
66+
})
67+
ginkgo.AfterEach(func() {
68+
if cleanUp != nil {
69+
cleanUp()
70+
}
5571
})
5672
ginkgo.It("should spread the pods of a service across zones", func() {
5773
SpreadServiceOrFail(f, 5*zoneCount, imageutils.GetPauseImageName())

0 commit comments

Comments
 (0)