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

Enabling cron expression for configuration #124

Open
bitchecker opened this issue Dec 31, 2024 · 1 comment
Open

Enabling cron expression for configuration #124

bitchecker opened this issue Dec 31, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bitchecker
Copy link

Issue

In order to have more flexibility, will be a great feature to be able to configure schedules with cron expression too.

Problem to solve

The feature come from that when you need to update the uptime period, this is not flexible, and you need to act in the exact moment when you want to change the scheduling.

Further details

For example, during Christmas holidays, if you want to configure a downtime in this period, but you're in the previous week, you need to update the configuration at the end of the week (mon-fri) and update with never...after that you need to reconfigure the tool on the last day of holiday's week for having a working cluster on the next Monday!

Proposal

With a cron expression instead, you can add a list of days and be more flexible.

Who can address the issue

Other links/references

@samuel-esp
Copy link
Collaborator

Hi @bitchecker we'll take this proposal under consideration, thank you a lot for suggesting!

In the meanwhile, take a look at this section of the documentation (https://github.com/caas-team/py-kube-downscaler?tab=readme-ov-file#uptime--downtime-spec). We have like a hidden feature that many people are not aware of that is called "absolute specification" and could be useful in these kind of situations (downtime for large periods like christmas holidays)

Quoting the docs:

Absolute specifications have the format <TIME_FROM>-<TIME_TO> where each <TIME> is an ISO 8601 date and time of the format <YYYY>-<MM>-<DD>T<HH>:<MM>:<SS>[+-]<TZHH>:<TZMM>

For example if you want to downscale the Cluster during Christimas holidays you could use

DEFAULT_DOWNTIME: 2024-12-23T08:00:00+01:00-2025-01-02T08:00:00+01:00

(The cluster will be up and running outside of the period 23 December-2 January)

DEFAULT_UPTIME: 2025-01-02T08:00:00+01:00-2025-01-05T23:00:00+01:00

(You would set up this configuration the last day before your Christmas Holidays. The cluster will be up and running again starting from January 2nd, then you could switch the configuration to the Classic Specification at the end of that week)

You could also combine more holidays at the same time, for example in some countries January 6th is a bank holiday which is a monday for 2025. Using "Comma Configurations" you could use this configuration to set up the Cluster both for Christmas holidays and January 6th Holiday

DEFAULT_DOWNTIME: 2024-12-23T08:00:00+01:00-2025-01-02T08:00:00+01:00,2025-01-03T19:00:00+01:00-2025-01-07T08:00:00+01:00

(The cluster will be up and running outside of the period 23 December-1 January at 8AM and outside of the period 4 January-7 January at 8AM)

You could set up a similar configuration also for DEFAULT_UPTIME.

Keep in mind that you can switch from/to Absolute Specification/Classic Specification at anytime, the only requisite is that you need to restart the Downscaler Deployment in order to take the new configuration. Hope it can help!

@samuel-esp samuel-esp added the enhancement New feature or request label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants