示例#1
0
// Validate validates a new job.
func (jobStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
	job := obj.(*batch.Job)
	// TODO: move UID generation earlier and do this in defaulting logic?
	if job.Spec.ManualSelector == nil || *job.Spec.ManualSelector == false {
		generateSelector(job)
	}
	return validation.ValidateJob(job)
}
示例#2
0
// ValidateUpdate is the default update validation for an end user.
func (jobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
	validationErrorList := validation.ValidateJob(obj.(*batch.Job))
	updateErrorList := validation.ValidateJobUpdate(obj.(*batch.Job), old.(*batch.Job))
	return append(validationErrorList, updateErrorList...)
}