Skip to content

Commit 3d35d49

Browse files
authored
fix: Admission Webhook blocks ScaledObject without metricType with fallback
Signed-off-by: rickbrouwer <[email protected]>
1 parent 720ae0e commit 3d35d49

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apis/keda/v1alpha1/scaledobject_types.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,13 @@ func CheckFallbackValid(scaledObject *ScaledObject) error {
305305
if trigger.Type == cpuString || trigger.Type == memoryString {
306306
continue
307307
}
308-
// If at least one trigger is of the type `AverageValue`, then having fallback is valid.
309-
if trigger.MetricType == autoscalingv2.AverageValueMetricType {
308+
309+
effectiveMetricType := trigger.MetricType
310+
if effectiveMetricType == "" {
311+
effectiveMetricType = autoscalingv2.AverageValueMetricType
312+
}
313+
314+
if effectiveMetricType == autoscalingv2.AverageValueMetricType {
310315
fallbackValid = true
311316
break
312317
}

0 commit comments

Comments
 (0)