Description
Report
When creating a HTTPScaledObject, it's optional to set .spec.replicas.max
. This should result on the creation of a ScaledObject with .spec.maxReplicaCount
unset, causing the ScaledObject controller use the default value of 100 for the field. But the add-on is creating a ScaledObject with .spec.maxReplicaCount
set to 0, leading to an unexpected behaviour to users going through Keda's documentation.
Expected Behavior
The add-on shouldn't set .spec.maxReplicaCount
to 0 unless explicitly defined by the user.
Actual Behavior
The add-on is setting .spec.maxReplicaCount
to 0 by default.
Steps to Reproduce the Problem
- Create a HTTPScaledObject without specifying
.spec.replicas.max
. - Check that the ScaledObject created by the add-on has
.spec.maxReplicaCount
set to 0 instead of being undefined.
Logs from KEDA HTTP operator
N/A
What version of the KEDA HTTP Add-on are you running?
0.4.0
Kubernetes Version
1.24
Platform
Microsoft Azure
Anything else?
The problem originates on the struct definition of HTTPScaledObject for .spec.replicas
. Its members are not pointers, so they will have Golang Zero Values (https://go.dev/tour/basics/12) by default. This is not a problem on most fields, but .spec.maxReplicaCount
, just like some other fields (https://keda.sh/docs/2.0/concepts/scaling-deployments/#scaledobject-spec), has a non-zero default value, making the use of non-pointer attributes a problem.
http-add-on/operator/api/v1alpha1/httpscaledobject_types.go
Lines 82 to 87 in ab7ce09
Metadata
Metadata
Assignees
Labels
Type
Projects
Status