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

Facing issue for Minutes Value in scheduler_cron_expression #591

Open
14Rahul opened this issue Jan 16, 2024 · 2 comments
Open

Facing issue for Minutes Value in scheduler_cron_expression #591

14Rahul opened this issue Jan 16, 2024 · 2 comments
Assignees
Labels

Comments

@14Rahul
Copy link

14Rahul commented Jan 16, 2024

After setting minutes value in scheduler_cron_expression the updater only running once but it should do rolling update for all instances by running multiple time. When is set * for minute value it is running each minute for that hour but I want to set that value to 30 minutes which I am unable to set.

My current cron expression is " * * 2 * * Sun " but I want to set " * 30 1 * * Sun " but second one not working multiple time

@gthao313
Copy link
Member

@14Rahul sorry for late reply. I'm trying to reproduce this issue and will get back to you soon.

@ytsssun ytsssun self-assigned this Apr 6, 2024
@ytsssun
Copy link
Contributor

ytsssun commented Apr 9, 2024

Thanks @14Rahul for open this issue.

As mentioned in the README, cron expression supports both time window or one-time execution.

A cron expression can be configured to a time window or a specific trigger time. When users specify cron expressions as a time window, the bottlerocket update operator will operate node updates within that update time window. When users specify cron expression as a specific trigger time, brupop will update and complete all waitingForUpdate nodes on the cluster when that time occurs.

To clarify on the cron expression you mentioned:

"* * 2 * * Sun" is going to create time windows. To break it down:
Seconds (*): Every second.
Minutes (*): Every minute.
Hours (2): At 2 AM.
Day of the Month (*): Every day of the month.
Month (*): Every month.
Day of the Week (Sun): Only on Sunday.
This means it will create time window for the entire hour of 2AM each Sunday for the update. During that time window, Brupop controller will try to update all the labeled nodes with a rolling update defined by max_concurrent_updates (e.g. max_concurrent_updates=1 means brupop will update 1 node at a time). This cron expression gives brupop 1hr window to do the update. It will halt the update if the current time is out of the 1hr time window. If you do not have a large fleet in your cluster, brupop may be able to update all of the labeled nodes.

To also clarify on the other cron expression:

" * 30 1 * * Sun" will create much shorter time windows. To break it down:
Seconds (*): Every second.
Minutes (30): 30th minute of the hour.
Hours (1): At 1 AM.
Day of the Month (*): Every day of the month.
Month (*): Every month.
Day of the Week (Sun): Only on Sunday.
This will let the brupop update happen at 1:30 AM of each Sunday, but will only give a 1 minute time window for the execution, since the update will be halted at 1:31:00 AM. The observation you had essentially shows that, brupop was only able to update a single node using the time window defined by the new cron expression.

Reproduction

I was able to reproduce the use case and getting the same result if I specified a fixed value for the minute:

helm get values brupop-operator                                                                                  
USER-SUPPLIED VALUES:
scheduler_cron_expression: '* 24 * * * * *'


kubectl get brs --namespace brupop-bottlerocket-aws
NAME                                              STATE   VERSION   TARGET STATE   TARGET VERSION   CRASH COUNT
xxx.us-west-2.compute.xxx   Idle    1.19.2    Idle           <no value>       0
xxx.us-west-2.compute.xxx   Idle    1.19.4    Idle           1.19.4           0
xxx.us-west-2.compute.xxx   Idle    1.19.2    Idle           <no value>       0

You can see that only a single node was getting updated to the new version.

Recommendation

If you intention is to set brupop to execute in the first 30min of that hour (1AM). You could use this expression:

" * 0-29 1 * * Sun"

This expression will allow the update execution from 01:00:00AM - 01:29:59AM of each Sunday.

If you are more interested in scheduling the update on a specific moment and are less interested in setting the execution time window, you can also use "0 0 2 * * Sun", it will create a update event at 02:00:00AM each Sunday and let brupop update the nodes until the update is applied to all the labeled nodes.

Let me know if you have any more question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants