From 191629151e53220bfa68d949043978d25712df4c Mon Sep 17 00:00:00 2001 From: Gede Wahyu Date: Thu, 15 Nov 2018 18:18:21 +0700 Subject: [PATCH] Remove the differentiation between currentReplicas==1 and not Signed-off-by: Gede Wahyu --- gateway/handlers/alerthandler.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gateway/handlers/alerthandler.go b/gateway/handlers/alerthandler.go index d0a76a0f..4eac2370 100644 --- a/gateway/handlers/alerthandler.go +++ b/gateway/handlers/alerthandler.go @@ -100,14 +100,10 @@ func CalculateReplicas(status string, currentReplicas uint64, maxReplicas uint64 step := uint64((float64(maxReplicas) / 100) * float64(scalingFactor)) if status == "firing" && step > 0 { - if currentReplicas == 1 { - newReplicas = step + if currentReplicas+step > maxReplicas { + newReplicas = maxReplicas } else { - if currentReplicas+step > maxReplicas { - newReplicas = maxReplicas - } else { - newReplicas = currentReplicas + step - } + newReplicas = currentReplicas + step } } else { // Resolved event. newReplicas = minReplicas