-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added hpa/v1 generator to kubectl autoscale #26775
Conversation
cc @jszczepkowski @mwielgus @kubernetes/autoscaling |
LGTM for HPA part. |
This also change |
@@ -64,7 +64,7 @@ kubectl autoscale rc foo --max=5 --cpu-percent=80 | |||
--cpu-percent=-1: The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, the server will apply a default value. | |||
--dry-run[=false]: If true, only print the object that would be sent, without sending it. | |||
-f, --filename=[]: Filename, directory, or URL to a file identifying the resource to autoscale. | |||
--generator="horizontalpodautoscaler/v1beta1": The name of the API generator to use. Currently there is only 1 generator. | |||
--generator="horizontalpodautoscaler/v1": The name of the API generator to use. Currently there are supported 2 generators: horizontalpodautoscaler/v1beta1 and horizontalpodautoscaler/v1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "2 supported generators"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@janetkuo comments applied. PTAL |
# autoscale 1~2 pods, CPU utilization 70%, rc specified by file, using old generator | ||
kubectl autoscale -f hack/testdata/frontend-controller.yaml "${kube_flags[@]}" --max=2 --cpu-percent=70 --generator=horizontalpodautoscaler/v1beta1 | ||
kube::test::get_object_assert 'hpa frontend' "{{$hpa_min_field}} {{$hpa_max_field}} {{$hpa_cpu_field}}" '1 2 70' | ||
kubectl delete hpa frontend "${kube_flags[@]}" | ||
# autoscale 2~3 pods, default CPU utilization (80%), rc specified by name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix this comment also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
only nits |
@k8s-bot e2e test this issue: #IGNORE |
@piosz |
1 similar comment
@piosz |
After looking at it closer I found that both generators (v1 and v1beta1) are generating exactly the same The versioning of generator and the versioning of the API is actually unrelated. There's no need to add the new generator I'm curious whether this'd work against clusters that don't have extensions/v1beta1 or autoscaling/v1 hpa. Perhaps we should add service discovery (like what we had in pkg/kubectl/cmd/run.go) before using the generator in autoscale. @kubernetes/kubectl |
@janetkuo are you ok with just renaming the existing generator v1beta1 to just v1? In Kubernetes 1.3 both extensions/v1beta1 and autoscaling/v1 are supported though autoscaling is default option. |
@piosz just renaming sounds good. To make it backward-compatible, we can create a v1 generator for hpa which is the same as v1beta1 generator, but hide the v1beta1 one in help text. |
I updated flag description. PTAL |
GCE e2e build/test passed for commit 1818b5b. |
Automatic merge from submit-queue |
ref #21577