mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Introduce HPA v2 API Objects
This commit introduces the autoscaling/v2alpha1 API group, which currently contains the first alpha of the new HorizontalPodAutoscaler object.
This commit is contained in:
@@ -1612,8 +1612,8 @@ run_recursive_resources_tests() {
|
||||
output_message=$(! kubectl autoscale --min=1 --max=2 -f hack/testdata/recursive/rc --recursive 2>&1 "${kube_flags[@]}")
|
||||
# Post-condition: busybox0 & busybox replication controllers are autoscaled
|
||||
# with min. of 1 replica & max of 2 replicas, and since busybox2 is malformed, it should error
|
||||
kube::test::get_object_assert 'hpa busybox0' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '1 2 <no value>'
|
||||
kube::test::get_object_assert 'hpa busybox1' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '1 2 <no value>'
|
||||
kube::test::get_object_assert 'hpa busybox0' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '1 2 80'
|
||||
kube::test::get_object_assert 'hpa busybox1' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '1 2 80'
|
||||
kube::test::if_has_string "${output_message}" "Object 'Kind' is missing"
|
||||
kubectl delete hpa busybox0 "${kube_flags[@]}"
|
||||
kubectl delete hpa busybox1 "${kube_flags[@]}"
|
||||
@@ -2221,7 +2221,7 @@ run_rc_tests() {
|
||||
kubectl delete hpa frontend "${kube_flags[@]}"
|
||||
# autoscale 2~3 pods, no CPU utilization specified, rc specified by name
|
||||
kubectl autoscale rc frontend "${kube_flags[@]}" --min=2 --max=3
|
||||
kube::test::get_object_assert 'hpa frontend' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 <no value>'
|
||||
kube::test::get_object_assert 'hpa frontend' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 80'
|
||||
kubectl delete hpa frontend "${kube_flags[@]}"
|
||||
# autoscale without specifying --max should fail
|
||||
! kubectl autoscale rc frontend "${kube_flags[@]}"
|
||||
@@ -2280,7 +2280,7 @@ run_deployment_tests() {
|
||||
kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'nginx-deployment:'
|
||||
# autoscale 2~3 pods, no CPU utilization specified
|
||||
kubectl-with-retry autoscale deployment nginx-deployment "${kube_flags[@]}" --min=2 --max=3
|
||||
kube::test::get_object_assert 'hpa nginx-deployment' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 <no value>'
|
||||
kube::test::get_object_assert 'hpa nginx-deployment' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 80'
|
||||
# Clean up
|
||||
# Note that we should delete hpa first, otherwise it may fight with the deployment reaper.
|
||||
kubectl delete hpa nginx-deployment "${kube_flags[@]}"
|
||||
@@ -2471,7 +2471,7 @@ run_rs_tests() {
|
||||
kubectl delete hpa frontend "${kube_flags[@]}"
|
||||
# autoscale 2~3 pods, no CPU utilization specified, replica set specified by name
|
||||
kubectl autoscale rs frontend "${kube_flags[@]}" --min=2 --max=3
|
||||
kube::test::get_object_assert 'hpa frontend' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 <no value>'
|
||||
kube::test::get_object_assert 'hpa frontend' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '2 3 80'
|
||||
kubectl delete hpa frontend "${kube_flags[@]}"
|
||||
# autoscale without specifying --max should fail
|
||||
! kubectl autoscale rs frontend "${kube_flags[@]}"
|
||||
|
Reference in New Issue
Block a user