Is there a way to use rollout as a ScaledObject in Keda?

490 views Asked by At

I'm using argo rollout for canary, blue-green deployment in a production environment.

I would like to significantly reduce the number of replicas by leveraging "Keda" during certain off-peak times (e.g., midnight or early morning). However, I understand that Keda's ScaledObject does not officially support rollout.(https://keda.sh/docs/2.10/concepts/scaling-deployments/#scaling-of-custom-resources)

So, I tried defining a ScaledObject with kind: Rollout and tested it, but it doesn't work. Although we are already using hpa, I expect keda to control hpa according to scaledObject rules.

When looking at the kubectl get so command, so appears to have been successfully created, but there is no response. Also, no some special logs are generated in keda pods.

How can I solve it? Thanks

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: test-application-so
  annotations:
    scaledobject.keda.sh/transfer-hpa-ownership: "true"
    autoscaling.keda.sh/paused-replicas: "0"
    autoscaling.keda.sh/paused: "true"
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Rollout
    name: test-application-rollout
  pollingInterval: 5
  cooldownPeriod: 10
  minReplicaCount: 0
  maxReplicaCount: 10
  fallback:
    failureThreshold: 3
    replicas: 5
  advanced:
    restoreToOriginalReplicaCount: false
    horizontalPodAutoscalerConfig:
      behavior:
        scaleDown:
          policies:
          - type: Percent
            value: 100
            periodSeconds: 15
  triggers:
  - type: cron
    metadata:
      timezone: Asia/Seoul
      schedule: "15-30 17 * * *"
>>kubectl get so test-application-so
- NAMESPACE : default
- NAME : test-application-so
- SCALETARGETKIND : 
- SCALETARGETNAME : test-application-rollout
- MIN : 0
- MAX : 10
- TRIGGERS : cron 
- AUTHENTICATION :
- READY : True
- ACTIVE : UnKnown
- FALLBACK : 
- PAUSED : true
- AGE : { just up time }
1

There are 1 answers

2
Alberto Clemente On BEST ANSWER

I looking for a similar solution.

Are you sure that your ScaledObject is it correct?

scaleTargetRef:
    apiVersion: apps/v1

It doesn't sound good. Could it be:

scaleTargetRef:
    apiVersion: argoproj.io/v1alpha1