kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.42k stars 1.06k forks source link

Incorrect validation of fallback if the metric type is not explicitly configured #6066

Open salvacorts opened 2 months ago

salvacorts commented 2 months ago

Report

The fallback mechanism should only work if the metric type is AverageValue, which is the default (according to the docs).

If you do not explicitly declare the metric type, KEDA prints the following error:

2024-08-02T15:01:04Z    ERROR   scaledobject-validation-webhook validation error    {"name": "foo", "error": "MetricType=, but Fallback can only be enabled for triggers with metric of type AverageValue"}****

Expected Behavior

KEDA should interpret an empty metricType as the default AverageValue.

Actual Behavior

KEDA prints an error

Steps to Reproduce the Problem

  1. Create a ScaledObject with fallback enabled (but without explicitly declaring the metricType of the scaler)
  2. Error is printed

Logs from KEDA operator

2024-08-02T15:01:04Z    ERROR   scaledobject-validation-webhook validation error    {"name": "foo", "error": "MetricType=, but Fallback can only be enabled for triggers with metric of type AverageValue"}

KEDA Version

2.14.1

Kubernetes Version

None

Platform

Any

Scaler Details

No response

Anything else?

No response

salvacorts commented 2 months ago

x-ref: https://github.com/kedacore/keda/pull/6065