keda: Introduce new time-window trigger

Proposal

Introduce new time-window trigger which allows you to scale based on a defined time window.

We could use inspiration from the kube-green project:

triggers:
- type: time-window
  weekdays: "Mo-Fri"
  start: "08:00"
  end: "20:00"
  timezone: Asia/Kolkata  # The acceptable values would be a value from the IANA Time Zone Database.

The cron scaler uses desiredReplicas but I believe it should just rely on min/max replica defined on the ScaledObject/ScaledJob.

This trigger should replace the cron scaler which is confusing in how it scales as end-users tend to think it behaves like jobs.

Use-Case

Scale workloads based on a time window.

Anything else?

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 35 (23 by maintainers)

Most upvoted comments

@neoakris , #2440 has just been merged and it’ll be released as experimental on next version (next week indeed xD)

Cron scaler reads as follows “not gonna work as a reoccuring schedule” ?

It’s a REALLY REALLY common pattern that you have day/night or weekends or holidays that have lower traffic and it would make sense to scale down during this period. Many workloads are predictable.

Any plans to add this scaler ?

I would like to scale based on metrics between 9to5 and scale in to min (or even min-X) between 5to9 ? What options I currently have when using KEDA ?

It is important to mention, however, that this new timer external scaler will have a dependency on Azure Storage and is for Azure Functions; no @raorugan? 😃

nice @sbdtu5498 ❤️ But remember to implement as a new scaler, cron scaler should be backward compatible

Then I’d argue that we should not deprecate the cron scaler and just add it next to it, no?

Hm so during a given time window, you might want to scale in instead of out then? Why not invert the window then? To me it feels more natural to always scale to max during window and min outside of window.