Remove hacks from ScheduledJobs cron spec parsing
Previusly github.com/robfig/cron library did not allow passing cron spec without seconds. Previous commit updates the library, which has additional method ParseStandard which follows the standard cron spec, iow. minute, hour, day of month, month, day of week.
This commit is contained in:
@@ -199,12 +199,7 @@ func validateConcurrencyPolicy(concurrencyPolicy *batch.ConcurrencyPolicy, fldPa
|
||||
|
||||
func validateScheduleFormat(schedule string, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
// TODO soltysh: this should be removed when https://github.com/robfig/cron/issues/58 is fixed
|
||||
tmpSchedule := schedule
|
||||
if len(schedule) > 0 && schedule[0] != '@' {
|
||||
tmpSchedule = "0 " + schedule
|
||||
}
|
||||
if _, err := cron.Parse(tmpSchedule); err != nil {
|
||||
if _, err := cron.ParseStandard(schedule); err != nil {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, schedule, err.Error()))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user