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

minReplicaCount not applied on a trigger type: cron #5795

Open
benoit-parmentier-2 opened this issue May 11, 2024 · 0 comments
Open

minReplicaCount not applied on a trigger type: cron #5795

benoit-parmentier-2 opened this issue May 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@benoit-parmentier-2
Copy link

Report

Hello,

On my ScaledObject, I configured a type: cron trigger.
The cron type trigger allows me to scale to 0, as shown here: https://keda.sh/docs/2.13/scalers/cron/#scale-to-0-during-off-hours.

  • I would like outside of the 7-21 range to have the minReplicaCount:0 applied.
  • I would like in the range 7-21, other triggers to be used, for example type: cpu or type: datadog

Expected Behavior

1) With the configuration below scaledobject-cron-only.yaml.

It works as expected.

  • Between start and end, the desiredReplicas: 2
  • Outside of start and end, the minReplicaCount: 0 is applied
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: nuxtjs-helloworld-green
  minReplicaCount: 0
  triggers:
    - type: cron
      metadata:
        timezone: "Europe/Paris"
        start: "0 7 * * *"
        end: "30 10 * * *"
        desiredReplicas: "2"

2) With the configuration below scaledobject-cron-memory.yaml

It works as expected.

  • Between start and end, the desiredReplicas: 2, plus autoscaling works well on memory
  • Outside of start and end, the minReplicaCount: 0 is applied
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: nuxtjs-helloworld-green
  minReplicaCount: 0
  pollingInterval: 30
  cooldownPeriod: 3
  maxReplicaCount: 5
  fallback:
    failureThreshold: 3
    replicas: 5
  triggers:
    - type: memory
      metricType: Utilization
      metadata:
        value: "1"
    - type: cron
      metadata:
        timezone: "Europe/Paris"
        start: "0 7 * * *"
        end: "30 10 * * *"
        desiredReplicas: "2"

3) With the configuration below scaledobject-cron-datadog.yaml

It doesn't work as expected.

  • Between start and end, the desiredReplicas: 2
  • Outside of start and end, the minReplicaCount: 0 is not applied. There is a pod that is created.
  triggers:
    - type: cron
      metadata:
        timezone: "Europe/Paris"
        start: "0 7 * * *"
        end: "30 10 * * *"
        desiredReplicas: "2"
    - authenticationRef:
        kind: ClusterTriggerAuthentication
        name: keda-datadog
      metadata:
        age: "120"
        lastAvailablePointOffset: "1"
        metricUnavailableValue: "1"
        query: sum:nginx.net.request_per_s{env:preprod,service:nuxtjs-helloworld}
        queryValue: "100"
        timeWindowOffset: "30"
      metricType: AverageValue
      type: datadog

Could you explain to me why configuration 3 does not enforce the minReplicaCount: 0 ?

Thanks a lot,
Benoît

Actual Behavior

As stated in my 3) point, when I put a type:datadog trigger with a trigger type:cron, it doesn't work.

Steps to Reproduce the Problem

As stated in my 3) point, you can use the configuration below.

  triggers:
    - type: cron
      metadata:
        timezone: "Europe/Paris"
        start: "0 7 * * *"
        end: "30 10 * * *"
        desiredReplicas: "2"
    - authenticationRef:
        kind: ClusterTriggerAuthentication
        name: keda-datadog
      metadata:
        age: "120"
        lastAvailablePointOffset: "1"
        metricUnavailableValue: "1"
        query: sum:nginx.net.request_per_s{env:preprod,service:nuxtjs-helloworld}
        queryValue: "100"
        timeWindowOffset: "30"
      metricType: AverageValue
      type: datadog

Logs from KEDA operator

example

KEDA Version

2.13.0

Kubernetes Version

1.28

Platform

Microsoft Azure

Scaler Details

No response

Anything else?

We use Keda version 2.13.2 (not possible to select this version in KEDA Version dropdown list)

@benoit-parmentier-2 benoit-parmentier-2 added the bug Something isn't working label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant