-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 functionality for specifying target average value for object me… #72872
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Hi @arjunrn. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
How was this change tested?
@mwielgus I have not tested it with anything more than the unit tests. The logic is the same as |
I'm not saying you need to add e2e test, but if you wanted to there are e2e tests for custom metrics in https://github.com/kubernetes/kubernetes/blob/master/test/e2e/autoscaling/custom_metrics_stackdriver_autoscaling.go. Problem is those are all using stackdriver, so you may not have an option to run it locally. I think it would be ok to merge a reasonably looking test and just letting CI run it to make sure it works. |
@MaciekPytel I have already added unit tests both for the replica calculator and the controller which are based on existing tests. Is there anything which you think is missing? |
@arjunrn I'm good. I don't think e2e test is necessary for this change, but since you mentioned it I commented on how to add it. |
I want to confirm that you build K8S release with this PR compiled in, ran it, tested it manually and it worked fine. |
@mwielgus I applied this PR to the 1.12.4 release and tested it with a deployment for ingress metrics. It works as expected. The only problem is that when the HPA is described it configured to use only
I would like to fix this as well before the PR is merged. |
@mwielgus Can you review this PR now? I've added the changes for describing the HPA. |
/ok-to-test |
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
c7e9454
to
c99d505
Compare
/lgtm |
/approve |
/assign @smarterclayton |
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.
/approve
kubectl changes
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arjunrn, mwielgus, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Value: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI), | ||
} | ||
return replicaCountProposal, timestampProposal, fmt.Sprintf("%s metric %s", metricSpec.Object.DescribedObject.Kind, metricSpec.Object.Metric.Name), nil | ||
} else if metricSpec.Object.Target.Type == autoscalingv2.AverageValueMetricType { |
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: 'else' can be omitted
Any ideas when this will land in a release? |
Is there a workaround for this in older releases ? When prometheus adapter is used for JVM pods then Object type is the only way for custom metrics and targetAverageValue not working kills us . Which release will this be coming ? |
@arunpmohan which version are you on? If you are on v1.12 or later then https://github.com/zalando-incubator/kube-metrics-adapter could maybe be an option for you, it will support averageValue for prometheus once we merge: zalando-incubator/kube-metrics-adapter#53 |
Thanks for your reply.I am on 1.13.4 and i was k8s-prometheus-adapter for JVM metrics https://github.com/DirectXMan12/k8s-prometheus-adapter. So with the link you said will it replace the prometheus adapter or the metric server ? I am guessing metric server and i will still need prometheus adapter. correct ? Also is there a helm chart available to deploy that. I couldn't find any. |
It's an alternative to the k8s-prometheus-adapter. You can read the difference here: https://github.com/zalando-incubator/kube-metrics-adapter#prometheus-collector We don't have a helm chart yet. |
This adds support for `averageValue` for the `request-per-second` metric based on Ingress Objects. This is only supported from Kubernetes `>=v1.14` (kubernetes/kubernetes#72872). When defining the HPA with `autoscaling/v2beta1` you still need to define `targetValue` even though it won't be used when `averageValue` is set. Once we default to `autoscaling/v2beta2` this akward API will be gone. Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
This adds support for `averageValue` for the `request-per-second` metric based on Ingress Objects. This is only supported from Kubernetes `>=v1.14` (kubernetes/kubernetes#72872). When defining the HPA with `autoscaling/v2beta1` you still need to define `targetValue` even though it won't be used when `averageValue` is set. Once we default to `autoscaling/v2beta2` this akward API will be gone. Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds the feature of using average values with object metrics in horizontal pod autoscalers.
Which issue(s) this PR fixes:
Fixes #72824
Special notes for your reviewer:
Does this PR introduce a user-facing change?: