mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #101055 from SimonCqk/master
fix: inaccurate miss schedule times of cronjob v2.
This commit is contained in:
commit
8eef6438e6
@ -154,9 +154,9 @@ func getRecentUnmetScheduleTimes(cj batchv1.CronJob, now time.Time) ([]time.Time
|
|||||||
// If there are too many (>100) unstarted times, it will raise a warning and but still return
|
// If there are too many (>100) unstarted times, it will raise a warning and but still return
|
||||||
// the list of missed times.
|
// the list of missed times.
|
||||||
func getNextScheduleTime(cj batchv1.CronJob, now time.Time, schedule cron.Schedule, recorder record.EventRecorder) (*time.Time, error) {
|
func getNextScheduleTime(cj batchv1.CronJob, now time.Time, schedule cron.Schedule, recorder record.EventRecorder) (*time.Time, error) {
|
||||||
starts := []time.Time{}
|
var (
|
||||||
|
earliestTime time.Time
|
||||||
var earliestTime time.Time
|
)
|
||||||
if cj.Status.LastScheduleTime != nil {
|
if cj.Status.LastScheduleTime != nil {
|
||||||
earliestTime = cj.Status.LastScheduleTime.Time
|
earliestTime = cj.Status.LastScheduleTime.Time
|
||||||
} else {
|
} else {
|
||||||
@ -200,8 +200,8 @@ func getNextScheduleTime(cj batchv1.CronJob, now time.Time, schedule cron.Schedu
|
|||||||
//
|
//
|
||||||
// I've somewhat arbitrarily picked 100, as more than 80,
|
// I've somewhat arbitrarily picked 100, as more than 80,
|
||||||
// but less than "lots".
|
// but less than "lots".
|
||||||
recorder.Eventf(&cj, corev1.EventTypeWarning, "TooManyMissedTimes", "too many missed start times: %d. Set or decrease .spec.startingDeadlineSeconds or check clock skew", len(starts))
|
recorder.Eventf(&cj, corev1.EventTypeWarning, "TooManyMissedTimes", "too many missed start times: %d. Set or decrease .spec.startingDeadlineSeconds or check clock skew", numberOfMissedSchedules)
|
||||||
klog.InfoS("too many missed times", "cronjob", klog.KRef(cj.GetNamespace(), cj.GetName()), "missed times", len(starts))
|
klog.InfoS("too many missed times", "cronjob", klog.KRef(cj.GetNamespace(), cj.GetName()), "missed times", numberOfMissedSchedules)
|
||||||
}
|
}
|
||||||
return t, err
|
return t, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user