From 2176e72210a724f2f52c90324c4c0f2c553b2606 Mon Sep 17 00:00:00 2001 From: Derek Wang Date: Mon, 20 Sep 2021 14:05:50 -0700 Subject: [PATCH] fix: more reasonable desired replicas calculation (#359) Signed-off-by: Derek Wang --- manager/controllers/scaling/scaling.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manager/controllers/scaling/scaling.go b/manager/controllers/scaling/scaling.go index 6614f4f9..ec1affdd 100644 --- a/manager/controllers/scaling/scaling.go +++ b/manager/controllers/scaling/scaling.go @@ -39,7 +39,11 @@ func GetDesiredReplicas(step dfv1.Step) (int, error) { desiredReplicas := currentReplicas pending, ok := GetPending(step) if !ok { // Haven't got pending data - return 1, nil + if currentReplicas > 0 { + return currentReplicas, nil + } else { + return 1, nil + } } lastPending, ok := GetLastPending(step) if !ok { // Haven't got last-pending data