move AllowElasticIndexedJobs into JobValidationOptions declaration

This commit is contained in:
Daniel Vega-Myhre 2023-02-27 18:45:58 +00:00
parent 12ceec47aa
commit 93a74afccb

View File

@ -169,6 +169,7 @@ func validationOptionsForJob(newJob, oldJob *batch.Job) batchvalidation.JobValid
opts := batchvalidation.JobValidationOptions{
PodValidationOptions: pod.GetValidationOptionsFromPodTemplate(newPodTemplate, oldPodTemplate),
AllowTrackingAnnotation: true,
AllowElasticIndexedJobs: utilfeature.DefaultFeatureGate.Enabled(features.ElasticIndexedJob),
}
if oldJob != nil {
opts.AllowInvalidLabelValueInSelector = opts.AllowInvalidLabelValueInSelector || metav1validation.LabelSelectorHasInvalidLabelValue(oldJob.Spec.Selector)
@ -185,9 +186,6 @@ func validationOptionsForJob(newJob, oldJob *batch.Job) batchvalidation.JobValid
opts.AllowMutableSchedulingDirectives = utilfeature.DefaultFeatureGate.Enabled(features.JobMutableNodeSchedulingDirectives) &&
suspended && notStarted
}
// Elastic indexed jobs (mutable completions iff updated parallelism == updated completions)
opts.AllowElasticIndexedJobs = utilfeature.DefaultFeatureGate.Enabled(features.ElasticIndexedJob)
return opts
}