diff --git a/pkg/fallback/fallback.go b/pkg/fallback/fallback.go index 7c03a250c30..8ca998fb118 100644 --- a/pkg/fallback/fallback.go +++ b/pkg/fallback/fallback.go @@ -111,10 +111,10 @@ func HasValidFallback(scaledObject *kedav1alpha1.ScaledObject) bool { func doFallback(scaledObject *kedav1alpha1.ScaledObject, metricSpec v2.MetricSpec, metricName string, currentReplicas int32, suppressedError error) []external_metrics.ExternalMetricValue { replicas := int64(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 { + // Check behavior 'UseCurrentReplicasAsMin' + if fallbackBehavior == kedav1alpha1.FallbackBehaviorUseCurrentReplicasAsMin { currentReplicasCount := int64(currentReplicas) if currentReplicasCount > replicas { replicas = currentReplicasCount @@ -137,11 +137,13 @@ func doFallback(scaledObject *kedav1alpha1.ScaledObject, metricSpec v2.MetricSpe } fallbackMetrics := []external_metrics.ExternalMetricValue{metric} - log.Info("Suppressing error, using fallback metrics", - "scaledObject.Namespace", scaledObject.Namespace, - "scaledObject.Name", scaledObject.Name, - "suppressedError", suppressedError, - "fallback.replicas", replicas) + log.Info("Suppressing error, using fallback metrics", + "scaledObject.Namespace", scaledObject.Namespace, + "scaledObject.Name", scaledObject.Name, + "suppressedError", suppressedError, + "fallback.behavior", fallbackBehavior, + "fallback.replicas", replicas, + "workload.currentReplicas", currentReplicas) return fallbackMetrics }