You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm going through Kubebuilder CronJob tutorial and is currently stuck on understanding the logic behind the function "getNextSchedule" to get the next cron schedule.
ifcronJob.Spec.StartingDeadlineSeconds!=nil {
// controller is not going to schedule anything below this pointschedulingDeadline:=now.Add(-time.Second*time.Duration(*cronJob.Spec.StartingDeadlineSeconds))
ifschedulingDeadline.After(earliestTime) {
earliestTime=schedulingDeadline
}
}
ifearliestTime.After(now) {
return time.Time{}, sched.Next(now), nil
}
starts:=0fort:=sched.Next(earliestTime); !t.After(now); t=sched.Next(t) {
I can only visualize the part to count the missed schedules if the earliest time is only the last scheduled time. What I don't understand is the calculation of schedulingDeadline variable (substraction but not addition) and how can earliestTime be after now and its assignment of schedulingDeadline?
I really appreciate if someone can help me shed light on this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I'm going through Kubebuilder CronJob tutorial and is currently stuck on understanding the logic behind the function "getNextSchedule" to get the next cron schedule.
I can only visualize the part to count the missed schedules if the earliest time is only the last scheduled time. What I don't understand is the calculation of schedulingDeadline variable (substraction but not addition) and how can earliestTime be after now and its assignment of schedulingDeadline?
I really appreciate if someone can help me shed light on this.
Beta Was this translation helpful? Give feedback.
All reactions