type missedSchedulesType … const noneMissed … const fewMissed … const manyMissed … func (e missedSchedulesType) String() string { … } // inActiveList checks if cronjob's .status.active has a job with the same UID. func inActiveList(cj *batchv1.CronJob, uid types.UID) bool { … } // inActiveListByName checks if cronjob's status.active has a job with the same // name and namespace. func inActiveListByName(cj *batchv1.CronJob, job *batchv1.Job) bool { … } func deleteFromActiveList(cj *batchv1.CronJob, uid types.UID) { … } // mostRecentScheduleTime returns: // - the last schedule time or CronJob's creation time, // - the most recent time a Job should be created or nil, if that's after now, // - value indicating either none missed schedules, a few missed or many missed // - error in an edge case where the schedule specification is grammatically correct, // but logically doesn't make sense (31st day for months with only 30 days, for example). func mostRecentScheduleTime(cj *batchv1.CronJob, now time.Time, schedule cron.Schedule, includeStartingDeadlineSeconds bool) (time.Time, *time.Time, missedSchedulesType, error) { … } // nextScheduleTimeDuration returns the time duration to requeue based on // the schedule and last schedule time. It adds a 100ms padding to the next requeue to account // for Network Time Protocol(NTP) time skews. If the time drifts the adjustment, which in most // realistic cases should be around 100s, the job will still be executed without missing // the schedule. func nextScheduleTimeDuration(cj *batchv1.CronJob, now time.Time, schedule cron.Schedule) *time.Duration { … } // nextScheduleTime returns the time.Time of the next schedule after the last scheduled // and before now, or nil if no unmet schedule times, and an error. // If there are too many (>100) unstarted times, it will also record a warning. func nextScheduleTime(logger klog.Logger, cj *batchv1.CronJob, now time.Time, schedule cron.Schedule, recorder record.EventRecorder) (*time.Time, error) { … } func copyLabels(template *batchv1.JobTemplateSpec) labels.Set { … } func copyAnnotations(template *batchv1.JobTemplateSpec) labels.Set { … } // getJobFromTemplate2 makes a Job from a CronJob. It converts the unix time into minutes from // epoch time and concatenates that to the job name, because the cronjob_controller v2 has the lowest // granularity of 1 minute for scheduling job. func getJobFromTemplate2(cj *batchv1.CronJob, scheduledTime time.Time) (*batchv1.Job, error) { … } // getTimeHash returns Unix Epoch Time in minutes func getTimeHashInMinutes(scheduledTime time.Time) int64 { … } type byJobStartTime … func (o byJobStartTime) Len() int { … } func (o byJobStartTime) Swap(i, j int) { … } func (o byJobStartTime) Less(i, j int) bool { … }