From cbaf77897ba39232e6b85cea226b85d895534a24 Mon Sep 17 00:00:00 2001 From: rickbrouwer Date: Wed, 15 Jan 2025 17:41:01 +0100 Subject: [PATCH] Update scale_scaledobjects.go Signed-off-by: rickbrouwer --- pkg/scaling/executor/scale_scaledobjects.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/scaling/executor/scale_scaledobjects.go b/pkg/scaling/executor/scale_scaledobjects.go index bafb307528a..d5d6680476c 100644 --- a/pkg/scaling/executor/scale_scaledobjects.go +++ b/pkg/scaling/executor/scale_scaledobjects.go @@ -207,15 +207,16 @@ func (e *scaleExecutor) RequestScale(ctx context.Context, scaledObject *kedav1al func (e *scaleExecutor) doFallbackScaling(ctx context.Context, scaledObject *kedav1alpha1.ScaledObject, currentScale *autoscalingv1.Scale, logger logr.Logger, currentReplicas int32) { targetReplicas := scaledObject.Spec.Fallback.Replicas + fallbackBehavior := scaledObject.Spec.Fallback.Behavior - // Check if we should use current replicas as minimum - if scaledObject.Spec.Fallback.UseCurrentReplicasAsMinimum != nil && *scaledObject.Spec.Fallback.UseCurrentReplicasAsMinimum && currentReplicas > targetReplicas { + // Check behavior 'UseCurrentReplicasAsMin' + if fallbackBehavior == kedav1alpha1.FallbackBehaviorUseCurrentReplicasAsMin && currentReplicas > targetReplicas { targetReplicas = currentReplicas } _, err := e.updateScaleOnScaleTarget(ctx, scaledObject, currentScale, targetReplicas) if err == nil { - logger.Info("Successfully set ScaleTarget replicas count to calculated fallback replicas", "Original Replicas Count", currentReplicas, "New Replicas Count", targetReplicas) + logger.Info("Successfully set ScaleTarget replicas count to calculated fallback replicas", "Original Replicas Count", currentReplicas, "New Replicas Count", targetReplicas, "Behavior", fallbackBehavior) } if e := e.setFallbackCondition(ctx, logger, scaledObject, metav1.ConditionTrue, "FallbackExists", "At least one trigger is falling back on this scaled object"); e != nil { logger.Error(e, "Error setting fallback condition")