Small review fixes

This commit is contained in:
Piotr Betkier 2022-02-25 14:12:36 +01:00
parent 50200dc54f
commit 13c3f091a7

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2015 The Kubernetes Authors. Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import (
var _ = SIGDescribe("[Feature:HPA] [Serial] [Slow] Horizontal pod autoscaling (non-default behavior)", func() { var _ = SIGDescribe("[Feature:HPA] [Serial] [Slow] Horizontal pod autoscaling (non-default behavior)", func() {
f := framework.NewDefaultFramework("horizontal-pod-autoscaling") f := framework.NewDefaultFramework("horizontal-pod-autoscaling")
ginkgo.Describe("with low downscale stabilization window", func() { ginkgo.Describe("with short downscale stabilization window", func() {
ginkgo.It("should scale down soon after the stabilization period", func() { ginkgo.It("should scale down soon after the stabilization period", func() {
ginkgo.By("setting up resource consumer and HPA") ginkgo.By("setting up resource consumer and HPA")
podCPURequest := 500 podCPURequest := 500
@ -50,10 +50,11 @@ var _ = SIGDescribe("[Feature:HPA] [Serial] [Slow] Horizontal pod autoscaling (n
) )
defer e2eautoscaling.DeleteHPAWithBehavior(rc, hpa.Name) defer e2eautoscaling.DeleteHPAWithBehavior(rc, hpa.Name)
// 30s of metrics window and fullWindowOfNewUsage := 30 * time.Second
// up to 30s until the old metrics window finishes windowWithOldUsagePasses := 30 * time.Second
// and additional 15s until metrics available on a new pod newPodMetricsDelay := 15 * time.Second
metricsAvailableDelay := 75 * time.Second metricsAvailableDelay := fullWindowOfNewUsage + windowWithOldUsagePasses + newPodMetricsDelay
hpaReconciliationInterval := 15 * time.Second hpaReconciliationInterval := 15 * time.Second
actuationDelay := 10 * time.Second actuationDelay := 10 * time.Second
maxHPAReactionTime := metricsAvailableDelay + hpaReconciliationInterval + actuationDelay maxHPAReactionTime := metricsAvailableDelay + hpaReconciliationInterval + actuationDelay
@ -64,6 +65,8 @@ var _ = SIGDescribe("[Feature:HPA] [Serial] [Slow] Horizontal pod autoscaling (n
waitBuffer := 1 * time.Minute waitBuffer := 1 * time.Minute
// making sure HPA is ready, doing its job and already has a recommendation recorded
// for stabilization logic before lowering the consumption
ginkgo.By("triggering scale up to record a recommendation") ginkgo.By("triggering scale up to record a recommendation")
rc.ConsumeCPU(3 * usageForSingleReplica) rc.ConsumeCPU(3 * usageForSingleReplica)
rc.WaitForReplicas(3, maxHPAReactionTime+maxResourceConsumerDelay+waitBuffer) rc.WaitForReplicas(3, maxHPAReactionTime+maxResourceConsumerDelay+waitBuffer)