Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScaledObject Cron Trigger 'end' expression is not working as expected. #1941

Closed
pazuzux opened this issue Jul 7, 2021 · 3 comments
Closed
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity

Comments

@pazuzux
Copy link

pazuzux commented Jul 7, 2021

Report

Hello everyone!
I needed to use the cron trigger to schedule a scale by time in a deployment and the end expression doesn't act as expected.

I'm setting start and end to run within 10 minutes, but only start is taken into account.

I needed to do the configuration below to solve the scale down:
cooldownPeriod and stabilizationWindowSeconds must have the same value to work properly, in my case 600 seconds.
I can change the end expression to any value.

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: myapp
spec:
  scaleTargetRef:
    name: myapp
  minReplicaCount: 3                                 
  maxReplicaCount: 10
  cooldownPeriod: 600                                
  advanced:                                          
    restoreToOriginalReplicaCount: true               
    horizontalPodAutoscalerConfig:                   
      behavior:                                      
        scaleDown:
          stabilizationWindowSeconds: 600
  triggers:
  - type: cron
    metadata:
      timezone: America/Sao_Paulo
      start: "25 * * * *"
      end:  "35 * * * *"
      desiredReplicas: "10"

Expected Behavior

I would like to only use the expressions Start and End for the CRON itself.
As mentioned in the documentation.

triggers:
- type: cron
  metadata:
    # Required
    timezone: Asia/Kolkata  # The acceptable values would be a value from the IANA Time Zone Database.
    start: 30 * * * *       # Every hour on the 30th minute
    end: 45 * * * *         # Every hour on the 45th minute
    desiredReplicas: "10"

Actual Behavior

I'm setting start and end to run within 10 minutes, but only start is taken into account.

I needed to do the configuration below to solve the scale down:
cooldownPeriod and stabilizationWindowSeconds must have the same value to work properly, in my case 600 seconds.
I can change the end expression to any value.

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: myapp
spec:
  scaleTargetRef:
    name: myapp
  minReplicaCount: 3                                 
  maxReplicaCount: 10
  cooldownPeriod: 600                                
  advanced:                                          
    restoreToOriginalReplicaCount: true               
    horizontalPodAutoscalerConfig:                   
      behavior:                                      
        scaleDown:
          stabilizationWindowSeconds: 600
  triggers:
  - type: cron
    metadata:
      timezone: America/Sao_Paulo
      start: "25 * * * *"
      end:  "35 * * * *"
      desiredReplicas: "10"

Steps to Reproduce the Problem

If you run the code to trigger a deployment using Cron the problem will occur.

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: myapp
spec:
  scaleTargetRef:
    name: myapp
  minReplicaCount: 3                                 
  maxReplicaCount: 10
  cooldownPeriod: 600                                
  advanced:                                          
    restoreToOriginalReplicaCount: true               
    horizontalPodAutoscalerConfig:                   
      behavior:                                      
        scaleDown:
          stabilizationWindowSeconds: 600
  triggers:
  - type: cron
    metadata:
      timezone: America/Sao_Paulo
      start: "25 * * * *"
      end:  "35 * * * *"
      desiredReplicas: "10"

Logs from KEDA operator

No response

KEDA Version

2.3.0

Kubernetes Version

1.18

Platform

Amazon Web Services

Scaler Details

Cron

Anything else?

No response

@pazuzux pazuzux added the bug Something isn't working label Jul 7, 2021
@zroubalik
Copy link
Member

Related: #1759

@stale
Copy link

stale bot commented Oct 13, 2021

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 stale bot added the stale All issues that are marked as stale due to inactivity label Oct 13, 2021
@stale
Copy link

stale bot commented Oct 20, 2021

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants