Only default Job fields when feature gates are enabled
Also use pointer for completionMode enum
This commit is contained in:
@@ -129,12 +129,12 @@ func validateJobSpec(spec *batch.JobSpec, fldPath *field.Path, opts apivalidatio
|
||||
if spec.TTLSecondsAfterFinished != nil {
|
||||
allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(*spec.TTLSecondsAfterFinished), fldPath.Child("ttlSecondsAfterFinished"))...)
|
||||
}
|
||||
// CompletionMode might be empty when IndexedJob feature gate is disabled.
|
||||
if spec.CompletionMode != "" {
|
||||
if spec.CompletionMode != batch.NonIndexedCompletion && spec.CompletionMode != batch.IndexedCompletion {
|
||||
// CompletionMode might be nil when IndexedJob feature gate is disabled.
|
||||
if spec.CompletionMode != nil {
|
||||
if *spec.CompletionMode != batch.NonIndexedCompletion && *spec.CompletionMode != batch.IndexedCompletion {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath.Child("completionMode"), spec.CompletionMode, []string{string(batch.NonIndexedCompletion), string(batch.IndexedCompletion)}))
|
||||
}
|
||||
if spec.CompletionMode == batch.IndexedCompletion {
|
||||
if *spec.CompletionMode == batch.IndexedCompletion {
|
||||
if spec.Completions == nil {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("completions"), fmt.Sprintf("when completion mode is %s", batch.IndexedCompletion)))
|
||||
}
|
||||
|
Reference in New Issue
Block a user