Remove the differentiation between currentReplicas==1 and not

Signed-off-by: Gede Wahyu <tokekbesi@gmail.com>
This commit is contained in:
Gede Wahyu
2018-11-15 18:18:21 +07:00
committed by Alex Ellis
parent 81db6514f7
commit 191629151e

View File

@ -100,15 +100,11 @@ func CalculateReplicas(status string, currentReplicas uint64, maxReplicas uint64
step := uint64((float64(maxReplicas) / 100) * float64(scalingFactor)) step := uint64((float64(maxReplicas) / 100) * float64(scalingFactor))
if status == "firing" && step > 0 { if status == "firing" && step > 0 {
if currentReplicas == 1 {
newReplicas = step
} else {
if currentReplicas+step > maxReplicas { if currentReplicas+step > maxReplicas {
newReplicas = maxReplicas newReplicas = maxReplicas
} else { } else {
newReplicas = currentReplicas + step newReplicas = currentReplicas + step
} }
}
} else { // Resolved event. } else { // Resolved event.
newReplicas = minReplicas newReplicas = minReplicas
} }