Change:
Currently the time it takes for HPA and CA to scale up after load increase is not measured at all, and this can lead to regressions that will be missed. This issue is about adding an e2e test that will prevent such regressions.
There are no sig labels on this issue. Please by:<br(1) mentioning a sig: <br(2) specifying the label manually: <br<brNote: method (1) will trigger a notification to the team. You can find the team list .
Filip, can you reopen? I cannot do this myself, and this issue is clearly not closed yet.
Thanks Wojtek!

Discussion:
func (scaleTest *HPAScaleTest) run(name, kind string, rc *common.ResourceConsumer, f *framework.Framework) { rc = common.NewDynamicResourceConsumer(name, kind, int(scaleTest.initPods), int(scaleTest.totalInitialCPUUsage), 0, 0, scaleTest.perPodCPURequest, 200, f) defer rc.CleanUp() <del> common.CreateCPUHorizontalPodAutoscaler(rc, scaleTest.targetCPUUtilizationPercent, scaleTest.minPods, scaleTest.maxPods) </del> <ins> hpa := common.CreateCPUHorizontalPodAutoscaler(rc, scaleTest.targetCPUUtilizationPercent, scaleTest.minPods, scaleTest.maxPods) defer common.DeleteHorizontalPodAutoscaler(rc, hpa.Name) </ins> rc.WaitForReplicas(int(scaleTest.firstScale)) if scaleTest.firstScaleStasis > 0 { rc.EnsureDesiredReplicas(int(scaleTest.firstScale), scaleTest.firstScaleStasis)

c, ns, controllerName, 1, startServiceInterval, startServiceTimeout)) } <del> func CreateCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu, minReplicas, maxRepl int32) { </del> <ins> func CreateCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu, minReplicas, maxRepl int32) *autoscalingv1.HorizontalPodAutoscaler { </ins> hpa := &autoscalingv1.HorizontalPodAutoscaler{ ObjectMeta: metav1.ObjectMeta{ Name:      rc.name,

TargetCPUUtilizationPercentage: &cpu, }, } <del> _, errHPA := rc.framework.ClientSet.Autoscaling().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa) </del> <ins> hpa, errHPA := rc.framework.ClientSet.Autoscaling().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa) </ins> framework.ExpectNoError(errHPA) <ins> return hpa } func DeleteHorizontalPodAutoscaler(rc *ResourceConsumer, autoscalerName string) { rc.framework.ClientSet.Autoscaling().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Delete(autoscalerName, nil) </ins> }

"//pkg/api/v1:go_default_library", "//pkg/api/v1/helper:go_default_library", "//pkg/apis/apps/v1beta1:go_default_library", <ins> "//pkg/apis/autoscaling/v1:go_default_library", </ins> "//pkg/apis/batch/v1:go_default_library", "//pkg/apis/extensions/v1beta1:go_default_library", "//pkg/controller:go_default_library",

import ( "fmt" <ins> autoscalingv1 "k8s.io/kubernetes/pkg/apis/autoscaling/v1" </ins> "k8s.io/kubernetes/test/e2e/common" "k8s.io/kubernetes/test/e2e/framework"

// HPAUpgradeTest tests that HPA rescales target resource correctly before and after a cluster upgrade. type HPAUpgradeTest struct { <del> rc *common.ResourceConsumer </del> <ins> rc  *common.ResourceConsumer hpa *autoscalingv1.HorizontalPodAutoscaler </ins> } func (HPAUpgradeTest) Name() string { return "hpa-upgrade" }

500, /* cpuLimit */ 200, /* memLimit */ f) <del> common.CreateCPUHorizontalPodAutoscaler( </del> <ins> t.hpa = common.CreateCPUHorizontalPodAutoscaler( </ins> t.rc, 20, /* targetCPUUtilizationPercent */ 1,  /* minPods */

// Teardown cleans up any remaining resources. func (t *HPAUpgradeTest) Teardown(f *framework.Framework) { // rely on the namespace deletion to clean up everything <ins> common.DeleteHorizontalPodAutoscaler(t.rc, t.hpa.Name) </ins> t.rc.CleanUp() }