From 44c3f0105ffb50a6cc5b71a2830068f585e4ebd9 Mon Sep 17 00:00:00 2001 From: Sukeesh Date: Sun, 7 Jul 2019 15:58:14 +0900 Subject: [PATCH] fix incorrect hpa status --- pkg/controller/podautoscaler/horizontal.go | 2 +- pkg/controller/podautoscaler/horizontal_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/podautoscaler/horizontal.go b/pkg/controller/podautoscaler/horizontal.go index 2c16e9c460b..10a5b8a6903 100644 --- a/pkg/controller/podautoscaler/horizontal.go +++ b/pkg/controller/podautoscaler/horizontal.go @@ -732,13 +732,13 @@ func convertDesiredReplicasWithRules(currentReplicas, desiredReplicas, hpaMinRep possibleLimitingReason = "the desired replica count is increasing faster than the maximum scale rate" } else { maximumAllowedReplicas = hpaMaxReplicas - possibleLimitingCondition = "TooManyReplicas" possibleLimitingReason = "the desired replica count is more than the maximum replica count" } if desiredReplicas < minimumAllowedReplicas { possibleLimitingCondition = "TooFewReplicas" + possibleLimitingReason = "the desired replica count is less than the minimum replica count" return minimumAllowedReplicas, possibleLimitingCondition, possibleLimitingReason } else if desiredReplicas > maximumAllowedReplicas { diff --git a/pkg/controller/podautoscaler/horizontal_test.go b/pkg/controller/podautoscaler/horizontal_test.go index 80328c3c5a1..f4228052a1e 100644 --- a/pkg/controller/podautoscaler/horizontal_test.go +++ b/pkg/controller/podautoscaler/horizontal_test.go @@ -2494,7 +2494,7 @@ func TestAvoidUncessaryUpdates(t *testing.T) { Status: v1.ConditionTrue, LastTransitionTime: *tc.lastScaleTime, Reason: "TooFewReplicas", - Message: "the desired replica count is more than the maximum replica count", + Message: "the desired replica count is less than the minimum replica count", }, }, },