hiddeco / cronjobber

Cronjobber is a cronjob controller for Kubernetes with support for time zones
Apache License 2.0
244 stars 39 forks source link

[Q&A] Behavior in during failures or DST #18

Open Jean85 opened 5 years ago

Jean85 commented 5 years ago

Nice job, thanks for releasing this!

Before starting to use this, I would like to know a little more about the behavior of cronjobber during edge cases:

hiddeco commented 5 years ago

Thanks for your interest in this project!

what happens if it goes down (even for a brief period) and a cronjob was scheduled during that interval?

Same as what would happen to the native controller, this is described in the official Kubernetes documentation and the logic for it can be found here.

what happens if a cronjob is scheduled during DST intervals?

Can you elaborate on 'DST intervals'? The controller recalculates the schedule times for each TZCronJob ~10 seconds, which completely refreshes the schedule list based on the current time in the timezone, so except for this 10 second timeframe, there is no room for schedule times based on an old DST/EST.

is the behavior of scheduled jobs the same as if I configured the same values on a cronjob, retry-policy-wise?

This is a 1-1 copy of the native controller with just some patches added to support timezones. No other logic has been touched (the answer is yes).

Jean85 commented 5 years ago

Can you elaborate on 'DST intervals'?

I meant something like: DST changes between 2 and 3 AM, what happens if I schedule something in that interval? But from the other answers it seems that I can infer that the behavior is somehow predictable.

hiddeco commented 5 years ago

Given your schedule is 30 2 * * * (every day at 2:30AM).

When DST begins (the clock is advanced by one hour at 2AM): It will run the next day (as there is no 2:30AM in this day).

When DST ends (the clock is set back one hour from 3AM to 2AM): It will run twice.

davejhahn commented 3 years ago

Given your schedule is 30 2 * * * (every day at 2:30AM).

When DST begins (the clock is advanced by one hour at 2AM): It will run the next day (as there is no 2:30AM in this day).

When DST ends (the clock is set back one hour from 3AM to 2AM): It will run twice.

I get the not running in the first example,. but the second example I don't follow.

If set to run at 2:30 AM, once 2:00 AM hits, time is set from 2:00am to 1:00 AM, and once 2:30 AM hits, it will run (and wouldn't have run yet the first time), so it would only run one time. Not sure where 3am is coming from.

draghuram commented 3 years ago

If you change the scheduled time to 1:30 am in "When DST ends" example given by @hiddeco, rest will follow. Job scheduled at 1:30 should run twice.