-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
timer: add user interfaces for timer framework #43837
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
2d7a267
to
3cb5c24
Compare
/retest |
3cb5c24
to
4657f99
Compare
/review default |
Summary
The PR introduces a new package
Potential problemsNo potential issues are identified. SuggestionsIt is suggested to add further details in the PR description regarding:
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
11f1edd
to
6dfd90c
Compare
/retest |
6dfd90c
to
b937dce
Compare
ffca71c
to
edadc41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Rest LGTM
} | ||
|
||
// SchedIntervalPolicy implements SchedEventPolicy, it is the policy of type `SchedEventInterval` | ||
type SchedIntervalPolicy struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what's the expected behavior if the client found it's too late to start the job (e.g. if the cluster is down for one or two days.). If they are only expected to execute when the time is within a small offset around the "expected" schedule (e.g. */5 * * * *
shouldn't happen at 00:02), a function like "NearestSchedTime" (or other better names) which will return the nearest "expected" schedule time would be really helpful.
The only difference between NearestSchedTime
and for-loop with NextEventTime
is that the NearestSchedTime
can calculate much faster if the timer is regular (e.g. for every 5 seconds). If we don't have this, we'll need to introduce a new range (or limitation) to avoid the "for-loop next" calculates forever, which will also make the expected behavior hard to describe/learn (See the .spec.startingDeadlineSeconds
in kubernetes cronjob as a counter example 🤦♂️ )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I think there is a principle in the framework that there is only one event triggering at the same time. For example, if the timer is set to trigger at the first minute of each hour but the cluster is down for one or two days. When the cluster recovered, there was still only one event triggered even if we have many events after the watermark.
Whether to execute all these jobs or ignore some "expired" depends on the user:
- If the user wants to execute all passed jobs, he should compute
NextEventTime
again and again until the returned event time after now. - If the user wants to ignore some jobs after a certain time, he can pass that time instead of the watermark to
NextEventTime
to compute the next event time after it.
When processing one event, a user can submit one or more jobs concurrency, it dependens to him.
edadc41
to
89215c5
Compare
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 89215c5
|
/retest |
What problem does this PR solve?
Issue Number: close #43836
What is changed and how it works?
timer
for timer frameworkTimerRecord
to present the meta of the timerTimerClient
to provide some operations of timer for userHook
for the users to custom actions when timer event is triggeredCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.