Change:
f := NewFramework("horizontal-pod-autoscaling") // CPU tests <del> It("[Skipped] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 1, 250, 0, 400, 100, f) </del> <ins> It("[Skipped][Autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 1, 250, 0, 500, 100, f) </ins> defer rc.CleanUp() <del> createCPUHorizontalPodAutoscaler(rc, "0.1") </del> <ins> createCPUHorizontalPodAutoscaler(rc, 20) </ins> rc.WaitForReplicas(3) rc.ConsumeCPU(700) rc.WaitForReplicas(5) }) <del> It("[Skipped] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 5, 700, 0, 200, 100, f) </del> <ins> It("[Skipped][Autoscaling Suite] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 5, 400, 0, 500, 100, f) </ins> defer rc.CleanUp() <del> createCPUHorizontalPodAutoscaler(rc, "0.3") </del> <ins> createCPUHorizontalPodAutoscaler(rc, 30) </ins> rc.WaitForReplicas(3) rc.ConsumeCPU(100) rc.WaitForReplicas(1) }) <del> // Memory tests It("[Skipped] should scale from 1 pod to 3 pods and from 3 to 5 (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 1, 0, 2200, 100, 2500, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "1000") rc.WaitForReplicas(3) rc.ConsumeMem(4200) rc.WaitForReplicas(5) }) It("[Skipped] should scale from 5 pods to 3 pods and from 3 to 1 (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 5, 0, 2200, 100, 2500, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "1000") rc.WaitForReplicas(3) rc.ConsumeMem(100) rc.WaitForReplicas(1) }) // Backup tests, currently disabled It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 1, 700, 0, 800, 100, f) defer rc.CleanUp() createCPUHorizontalPodAutoscaler(rc, "0.3") rc.WaitForReplicas(3) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 3, 0, 0, 100, 100, f) defer rc.CleanUp() createCPUHorizontalPodAutoscaler(rc, "0.7") rc.WaitForReplicas(1) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to maximum 5 pods (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 1, 700, 0, 800, 100, f) defer rc.CleanUp() createCPUHorizontalPodAutoscaler(rc, "0.1") rc.WaitForReplicas(5) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 1 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 1, 700, 0, 800, 100, f) defer rc.CleanUp() createCPUHorizontalPodAutoscaler(rc, "0.3") rc.WaitForReplicas(3) rc.ConsumeCPU(300) rc.WaitForReplicas(1) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod and from 1 to 3 (scale resource: CPU)", func() { rc = NewDynamicResourceConsumer("rc", 3, 0, 0, 800, 100, f) defer rc.CleanUp() createCPUHorizontalPodAutoscaler(rc, "0.3") rc.WaitForReplicas(1) rc.ConsumeCPU(700) rc.WaitForReplicas(3) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 1, 0, 800, 100, 900, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "300") rc.WaitForReplicas(3) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 3, 0, 0, 100, 100, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "700") rc.WaitForReplicas(1) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to 3 pods and from 3 to 1 (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 1, 0, 700, 100, 800, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "300") rc.WaitForReplicas(3) rc.ConsumeMem(100) rc.WaitForReplicas(1) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 3 pods to 1 pod and from 1 to 3 (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 3, 0, 0, 100, 800, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "300") rc.WaitForReplicas(1) rc.ConsumeMem(700) rc.WaitForReplicas(3) }) It("[Skipped][Horizontal pod autoscaling Suite] should scale from 1 pod to maximum 5 pods (scale resource: Memory)", func() { rc = NewDynamicResourceConsumer("rc", 1, 0, 700, 100, 800, f) defer rc.CleanUp() createMemoryHorizontalPodAutoscaler(rc, "100") rc.WaitForReplicas(5) }) </del> }) <del> func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu string) { glog.Fatal("createCPUHorizontalPodAutoscaler not implemented!") // TODO: reimplemente e2e tests for the new API. } // argument memory is in megabytes func createMemoryHorizontalPodAutoscaler(rc *ResourceConsumer, memory string) { glog.Fatal("createMemoryHorizontalPodAutoscaler not implemented!") // TODO: reimplemente e2e tests for the new API. </del> <ins> func createCPUHorizontalPodAutoscaler(rc *ResourceConsumer, cpu int) { minReplicas := 1 hpa := &extensions.HorizontalPodAutoscaler{ ObjectMeta: api.ObjectMeta{ Name:      rc.name, Namespace: rc.framework.Namespace.Name, }, Spec: extensions.HorizontalPodAutoscalerSpec{ ScaleRef: extensions.SubresourceReference{ Kind:        kind, Name:        rc.name, Namespace:   rc.framework.Namespace.Name, Subresource: subresource, }, MinReplicas:    &minReplicas, MaxReplicas:    5, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: cpu}, }, } _, errHPA := rc.framework.Client.Extensions().HorizontalPodAutoscalers(rc.framework.Namespace.Name).Create(hpa) expectNoError(errHPA) </ins> }

Discussion:
e.g. scale up if CPU usage exceeds 70% of CPU request. Subtasks: [x] Add API changes [x] Add implementation [x] Add support in kubectl to print status with cpu request utilization [x] Add e2e tests
I've sent main PR for review (). During your day/my night please look into kubectl changes and e2e tests.