Limit 52-character cronjob name validation to create

This commit is contained in:
Jordan Liggitt
2017-09-24 23:56:27 -04:00
parent 5f8726e427
commit b8155e107c
3 changed files with 35 additions and 1 deletions

View File

@@ -176,6 +176,14 @@ func ValidateCronJob(scheduledJob *batch.CronJob) field.ErrorList {
return allErrs
}
func ValidateCronJobUpdate(job, oldJob *batch.CronJob) field.ErrorList {
allErrs := apivalidation.ValidateObjectMetaUpdate(&job.ObjectMeta, &oldJob.ObjectMeta, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateCronJobSpec(&job.Spec, field.NewPath("spec"))...)
// skip the 52-character name validation limit on update validation
// to allow old cronjobs with names > 52 chars to be updated/deleted
return allErrs
}
func ValidateCronJobSpec(spec *batch.CronJobSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}