-
Notifications
You must be signed in to change notification settings - Fork 70
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
Support for randomness / hashed substitution in a trigger schedule #1421
Comments
This is an interesting one, potentially something could be done to add a simplified version of this - most likely by:
I don't want to promise this, but sounds like a neat idea if there is time to work on it. @adampetrovic It looks like the Jenkins implementation may allow for more complex substitutions such as H/10 or H(1-3)? |
Ideally this is something delegated to the cron library and all volsync needs to worry about is passing through the job name for hashing. Looking at https://github.com/robfig/cron, the last PR merged was 4 years ago, so I'm not going to blindly assume that route will be a fruitful one.
Yes it does, again it feels off though to have to think about implementing custom cron parsing in volsync. If volsync were open to using a fork of the cron library, I could have a go at implementing this. |
I have implemented basic support (just standard I have extended the API to add a function |
I think my initial reaction is I'd rather not point at a fork, but let me think about it a bit. With a fork:
If we put hashing code into volsync, we could also show the computed schedule in the status, so a user would be able to see what the hash resolved to which might be kind of nice. Disadvantage is it's not so clean and contained in cron parsing code. |
Rather than forking, what about switching to a different cron library that's more actively maintained? If they are willing to add hash support, of course. |
I couldn't find an existing library that supports setting a jitter in the cron format. I have to agreed that the jenkins cron format would be ideal. The author of robfig/cron was asking about to adding H support but closed the issue 😢 Judging by the authors Github activity they might not be coming back to support the project. @tesshuflower Another option could be (if upstream is truly abandoned) that backube could fork robfig/cron and support what's requested here in the library. I get that adding another project to your org might stretch your resources a bit so I totally get why you wouldn't want to; however, if adding this jitter / randomness / hashed substitution helps with both volsync and snapscheduler getting this feature maybe it can be considered? |
I was going to suggest the same thing. Given it's 4 years since the last commit I can't imagine the maintenance overhead being large. I'd be happy to volunteer my time to help with this, if needed |
Thanks for the offer @adampetrovic but perhaps we just put the specific hashing code into VolSync itself - this gives us more control and we can still keep it separate from the actual cron implementation. Steps:
This is something I can help with when I have some time - I'll take a look at your hashing function at some point and can perhaps use that (or I can get you to contribute it directly here if you prefer). Questions:
|
I think the primary set of features that cron already has like:
|
Are you sure you want to do this in volsync? There's a tonne of parsing / repacking unrelated to the Hash feature that would need to be implemented from scratch that already exists in the cron implementation. For what it's worth, I've now also added support for hashes with a range in my fork. |
I probably wasn't clear - if we support hashing, we'd just parse the hash values out, compute and put into the status - then scheduling would look at that resolved cron schedule (e.g |
Yes, I am aware :) Volsync would need to basically parse all possible permutations of a cron expression into individual fields and sub-fields within those fields as well as worry about the specifics of the Hash expression. Not impossible by any means, just a lot of edge cases to deal with for something that volsync shouldn't be directly concerned with (IMO). For example:
|
I also forgot that the parsing function would need to know which field it is parsing (seconds, minutes, hours etc) in order to generate a valid set of values within a range. |
agreed, it's not super simple, which I think is why we'd want to keep the set of use-cases we support for H to be constrained to something that would be useful to you, at least at first. |
For me just a simple |
Describe the feature you'd like to have.
Currently the trigger schedule directive on
ReplicationSource
supports a crontab style schedule or a static directive such asdaily
,yearly
etc.For those that are using a templatized
ReplicationSource
, many PVCs will inherit the schedule from a single template and therefore have the same trigger time, leading to many backup operations being triggered at the same time.See example of such a template here: https://github.com/adampetrovic/home-ops/blob/main/kubernetes/templates/volsync/minio.yaml#L34
Some cron implementations use
H
as a hashed substitution for a value:With this approach, volsync could take the name of the job as the hash value to evaluate to say a minute within the hour.
What is the value to the end user? (why is it a priority?)
Better load spreading of backups
How will we know we have a good solution? (acceptance criteria)
A user is able to defer random execution / jitter of backup times to the volsync operator instead of having to manage it themselves.
Additional context
The text was updated successfully, but these errors were encountered: