Skip to content

Commit

Permalink
fix: fix isFallbackEnabled when using scaling modifiers (#6521)
Browse files Browse the repository at this point in the history
Signed-off-by: Youssef Rabie <[email protected]>
Co-authored-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
y-rabie and zroubalik authored Feb 7, 2025
1 parent f92de1a commit 14f1fea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
- [v1.0.0](#v100)

## Unreleased
- **General**: Fix the check whether Fallback is enabled when using ScalingModifiers ([#6521](https://github.com/kedacore/keda/pull/6521))

- **General**: Introduce new Temporal scaler ([#4724](https://github.com/kedacore/keda/issues/4724))

Expand Down
7 changes: 6 additions & 1 deletion pkg/fallback/fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ func isFallbackEnabled(scaledObject *kedav1alpha1.ScaledObject, metricSpec v2.Me
return false
}

if metricSpec.External.Target.Type != v2.AverageValueMetricType {
// If we are using ScalingModifiers, we only care whether its metric type is AverageValue.
// If not, test the type of metricSpec passed.
if scaledObject.IsUsingModifiers() && scaledObject.Spec.Advanced.ScalingModifiers.MetricType != v2.AverageValueMetricType {
log.V(0).Info("Fallback can only be enabled for scalingModifiers with metric of type AverageValue", "scaledObject.Namespace", scaledObject.Namespace, "scaledObject.Name", scaledObject.Name)
return false
} else if !scaledObject.IsUsingModifiers() && metricSpec.External.Target.Type != v2.AverageValueMetricType {
log.V(0).Info("Fallback can only be enabled for triggers with metric of type AverageValue", "scaledObject.Namespace", scaledObject.Namespace, "scaledObject.Name", scaledObject.Name)
return false
}
Expand Down

0 comments on commit 14f1fea

Please sign in to comment.