-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
hpa: Don't scale down if at least one metric was invalid #99514
hpa: Don't scale down if at least one metric was invalid #99514
Conversation
@mikkeloscar: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Hi @mikkeloscar. 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. |
/ok-to-test |
/test pull-kubernetes-dependencies |
I agree completely we should keep this behavior. If the metric is invalid, we should prefer not to do anything. |
These test failures so far seem unrelated to the PR. E.g.
|
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
8636651
to
fef092b
Compare
@josephburnett I rebased on master and now all tests are passing! |
Ah, that's why the errors. Thanks /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: josephburnett, mikkeloscar 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 |
What type of PR is this?
/kind bug
/kind regression
What this PR does / why we need it:
The official autoscaling docs: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details
States the following:
This was working as stated up to and including Kubernetes v1.15. As part of v1.16 #74526 introduced a change which dropped the behavior of not scaling down if one metric was not correctly observed.
This PR re-introduces the old logic and reverts 2 tests covering the behavior but not testing the right thing (scaledown didn't happen because of the stabilization window, not because of the invalid metric). It also removes the two tests which were showing that scaledown does indeed happen despite at least one metric being unavailable/invalid.
Which issue(s) this PR fixes:
Fixes #99394
Special notes for your reviewer:
The logic was changed with the introduction of
HPAScaleToZero
and I imagine the idea was that an HPA should be able to scale to zero if there are no metrics. However, not only does it break the expectation from the API as documented in the docs, it also makes it much harder to reliably handle temporary unavailability of e.g. external metrics where you definitely don't want the HPA to start scaling down when it doesn't know what the missing metric would suggest.Scaling to 0 (or down) should happen if the metrics indicates this, not if the metrics are simply unavailable.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: