mirror of https://github.com/k3s-io/k3s
Fixed flaky cluster size autoscaling e2e.
parent
c1345ce2d9
commit
a8bd23542f
|
@ -29,6 +29,11 @@ import (
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
scaleUpTimeout = 20 * time.Minute
|
||||||
|
scaleDownTimeout = 30 * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
var _ = Describe("Autoscaling", func() {
|
var _ = Describe("Autoscaling", func() {
|
||||||
f := NewFramework("autoscaling")
|
f := NewFramework("autoscaling")
|
||||||
var nodeCount int
|
var nodeCount int
|
||||||
|
@ -58,20 +63,20 @@ var _ = Describe("Autoscaling", func() {
|
||||||
// Consume 50% CPU
|
// Consume 50% CPU
|
||||||
millicoresPerReplica := 500
|
millicoresPerReplica := 500
|
||||||
rc := NewStaticResourceConsumer("cpu-utilization", nodeCount*coresPerNode, millicoresPerReplica*nodeCount*coresPerNode, 0, int64(millicoresPerReplica), 100, f)
|
rc := NewStaticResourceConsumer("cpu-utilization", nodeCount*coresPerNode, millicoresPerReplica*nodeCount*coresPerNode, 0, int64(millicoresPerReplica), 100, f)
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount+1, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount+1, scaleUpTimeout))
|
||||||
|
|
||||||
rc.CleanUp()
|
rc.CleanUp()
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount, scaleDownTimeout))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("[Skipped] should scale cluster size based on cpu reservation", func() {
|
It("[Skipped] should scale cluster size based on cpu reservation", func() {
|
||||||
setUpAutoscaler("cpu/node_reservation", 0.5, nodeCount, nodeCount+1)
|
setUpAutoscaler("cpu/node_reservation", 0.5, nodeCount, nodeCount+1)
|
||||||
|
|
||||||
ReserveCpu(f, "cpu-reservation", 600*nodeCount*coresPerNode)
|
ReserveCpu(f, "cpu-reservation", 600*nodeCount*coresPerNode)
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount+1, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount+1, scaleUpTimeout))
|
||||||
|
|
||||||
expectNoError(DeleteRC(f.Client, f.Namespace.Name, "cpu-reservation"))
|
expectNoError(DeleteRC(f.Client, f.Namespace.Name, "cpu-reservation"))
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount, scaleDownTimeout))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("[Skipped][Autoscaling Suite] should scale cluster size based on memory utilization", func() {
|
It("[Skipped][Autoscaling Suite] should scale cluster size based on memory utilization", func() {
|
||||||
|
@ -80,20 +85,20 @@ var _ = Describe("Autoscaling", func() {
|
||||||
// Consume 60% of total memory capacity
|
// Consume 60% of total memory capacity
|
||||||
megabytesPerReplica := int(memCapacityMb * 6 / 10 / coresPerNode)
|
megabytesPerReplica := int(memCapacityMb * 6 / 10 / coresPerNode)
|
||||||
rc := NewStaticResourceConsumer("mem-utilization", nodeCount*coresPerNode, 0, megabytesPerReplica*nodeCount*coresPerNode, 100, int64(megabytesPerReplica+100), f)
|
rc := NewStaticResourceConsumer("mem-utilization", nodeCount*coresPerNode, 0, megabytesPerReplica*nodeCount*coresPerNode, 100, int64(megabytesPerReplica+100), f)
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount+1, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount+1, scaleUpTimeout))
|
||||||
|
|
||||||
rc.CleanUp()
|
rc.CleanUp()
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount, scaleDownTimeout))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("[Skipped] should scale cluster size based on memory reservation", func() {
|
It("[Skipped] should scale cluster size based on memory reservation", func() {
|
||||||
setUpAutoscaler("memory/node_reservation", 0.5, nodeCount, nodeCount+1)
|
setUpAutoscaler("memory/node_reservation", 0.5, nodeCount, nodeCount+1)
|
||||||
|
|
||||||
ReserveMemory(f, "memory-reservation", nodeCount*memCapacityMb*6/10)
|
ReserveMemory(f, "memory-reservation", nodeCount*memCapacityMb*6/10)
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount+1, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount+1, scaleUpTimeout))
|
||||||
|
|
||||||
expectNoError(DeleteRC(f.Client, f.Namespace.Name, "memory-reservation"))
|
expectNoError(DeleteRC(f.Client, f.Namespace.Name, "memory-reservation"))
|
||||||
expectNoError(waitForClusterSize(f.Client, nodeCount, 20*time.Minute))
|
expectNoError(waitForClusterSize(f.Client, nodeCount, scaleDownTimeout))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue