keda icon indicating copy to clipboard operation
keda copied to clipboard

Disabling scaledown is ignored

Open bakoontz2 opened this issue 2 years ago • 6 comments

Report

Kubernetes docs provide a means by which scaledowns can be disabled:

      behavior:
        scaleDown:
          selectPolicy: Disabled

However, ScaledObject doesn't seem to support this:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: test-scaledobject
spec:
  scaleTargetRef:
    name: test-keda-deploy
  pollingInterval: 30
  cooldownPeriod: 0
  #idleReplicaCount: 0
  minReplicaCount: 0
  maxReplicaCount: 1
  advanced:
    horizontalPodAutoScalerConfig:
      behavior:
        scaleDown:
          selectPolicy: Disabled

Expected Behavior

The expected behavior is that a triggering event would scale up to 1 pod, but once that triggering event was removed from the queue, scaledown to 0 would be disabled.

Actual Behavior

When the event queue is empty, the selectPolicy: Disabled directive is ignored and the pod count is scaled down to 0.

Steps to Reproduce the Problem

Logs from KEDA operator

example

KEDA Version

2.7.1

Kubernetes Version

1.21

Platform

Microsoft Azure

Scaler Details

Azure Scaler Bus

Anything else?

No response

bakoontz2 avatar Jun 07 '22 21:06 bakoontz2

@zroubalik Is this a bug or doc bug?

tomkerkhove avatar Jun 08 '22 13:06 tomkerkhove

I think that is a gap in the docs, the section horizontalPodAutoScalerConfig is passed to the HPA but the scaling from 1 to 0 is done by the operator. IMO, KEDA shouldn't take case about HPA custom behaviours because that it's responsibility from the HPA Controller.

JorTurFer avatar Jun 12 '22 14:06 JorTurFer

I think the side question here is - Do we allow end-users to configure all advanced HPA settings or just a handful?

tomkerkhove avatar Jun 13 '22 07:06 tomkerkhove

I'm not sure, but in this case the user problem is from 1 to 0 and the HPA doesn't work there, it's the operator itself. I mean, if the issue had been scaling in from 2 to 1, could be a bug in the parameters that we pass to HPA, but in this case, the operator doesn't respect that parameter because it's for the HPA. I'd say that the side question is more like, should KEDA parse HPA advanced configs and respect them if they apply also in 0-1-0?

JorTurFer avatar Jun 13 '22 07:06 JorTurFer

We should improve docs, to clearly mention that this setting applies to 1<->N scaling. But we can definitely think about adding some of those capabilities to 0<->1 as well.

zroubalik avatar Jun 13 '22 08:06 zroubalik

We should improve docs, to clearly mention that this setting applies to 1<->N scaling.

:100: and also if people can configure all advanced configuration options or not.

But we can definitely think about adding some of those capabilities to 0<->1 as well.

Sounds like a good idea; would you mind opening a feature request for this @zroubalik ?

tomkerkhove avatar Jun 13 '22 11:06 tomkerkhove

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 03 '22 13:09 stale[bot]

This issue has been automatically closed due to inactivity.

stale[bot] avatar Sep 10 '22 13:09 stale[bot]