Skip to content

Omitting scaleTargetRef.name creates broken ScaledObject #1421

@linkvt

Description

@linkvt

Report

HTTPScaledObject accepts resources with empty scaleTargetRef.name even when the http.keda.sh/skip-scaled-object-creation annotation is not set. This results in the controller creating an invalid ScaledObject downstream.

Expected Behavior

HTTPSO with a missing scaleTargetRef.name field and the missing annotation should either be rejected or marked as invalid, e.g. via a condition.

Actual Behavior

HTTPSO is accepted, SO is created with the missing name field which makes it not Ready:

status:
  conditions:
  - message: 'ScaledObject doesn''t have correct scaleTargetRef specification: ScaledObject.spec.scaleTargetRef.name
      is missing'
    reason: ScaledObjectCheckFailed
    status: "False"
    type: Ready
  - message: ScaledObject check failed
    reason: UnknownState
    status: Unknown
    type: Active

Steps to Reproduce the Problem

  1. Create an HTTPScaledObject without scaleTargetRef.name and without the skip annotation
  2. An invalid ScaledObject is created

Logs from KEDA HTTP operator

No response

HTTP Add-on Version

0.11.1

Kubernetes Version

1.33

Platform

Any

Anything else?

Idea: A dedicated Valid condition type could surface validation errors to users when they can't be caught at admission time, related to #902

We should maybe wait with the implementation though until we know how the HTTPSO CR will exist in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions