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.38k stars 1.06k forks source link

Unable to Use Behavior Field with KEDA ScaledObject #5827

Closed Ravikapadne closed 4 months ago

Ravikapadne commented 4 months ago

Report

Hi Team,

I'm unable to use the behavior field with KEDA's ScaledObject. Despite following the documentation and ensuring that KEDA is installed correctly, attempting to include the behavior field in the ScaledObject YAML results in a validation error.

Error:

error: error validating "newrelic_scaleobject_beh.yaml": error validating data: ValidationError(ScaledObject.spec): unknown field "behavior" in sh.keda.v1alpha1.ScaledObject.spec; if you choose to ignore these errors, turn validation off with --validate=false

ScaledObject Manifest with behavior:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: newrelic-scaledobject-keda
  namespace: default
spec:
  minReplicaCount: 1
  maxReplicaCount: 5
  scaleTargetRef:
    name: pscoreqa
  triggers:
    - type: new-relic
      metadata:
        nrql: "SELECT count(*) / uniqueCount(host) FROM Transaction WHERE appName = 'k8s-pscore-qa' SINCE 1 minute ago"
        noDataError: "true"
        threshold: '1000'
      authenticationRef:
        name: keda-trigger-auth-new-relic
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
        - type: "Absolute"
          value: 1
          periodSeconds: 60

Expected Behavior

behavior policy should apply along with KEDA

Actual Behavior

Getting the following error:

error: error validating "newrelic_scaleobject_beh.yaml": error validating data: ValidationError(ScaledObject.spec): unknown field "behavior" in sh.keda.v1alpha1.ScaledObject.spec; if you choose to ignore these errors, turn validation off with --validate=false

Steps to Reproduce the Problem

  1. Install KEDA v2.13.0 using Helm. 2.Apply the latest CRDs for KEDA. 3.Attempt to create a ScaledObject YAML with the behavior field included, similar to the following:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: newrelic-scaledobject-keda
  namespace: default
spec:
  minReplicaCount: 1
  maxReplicaCount: 5
  scaleTargetRef:
    name: pscoreqa
  triggers:
    - type: new-relic
      metadata:
        nrql: "SELECT count(*) / uniqueCount(host) FROM Transaction WHERE appName = 'k8s-pscore-qa' SINCE 1 minute ago"
        noDataError: "true"
        threshold: '1000'
      authenticationRef:
        name: keda-trigger-auth-new-relic
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
        - type: "Absolute"
          value: 1
          periodSeconds: 60

Logs from KEDA operator

example

KEDA Version

2.13.0

Kubernetes Version

1.29

Platform

Amazon Web Services

Scaler Details

No response

Anything else?

No response

zroubalik commented 4 months ago

behavior is defined in spec.advanced.horizontalPodAutoscalerConfig.behavior not spec.behavior.