add feature gate

This commit is contained in:
Daniel Vega-Myhre
2023-06-27 18:06:09 +00:00
parent 2176053415
commit a9afaa1eee
3 changed files with 17 additions and 2 deletions

View File

@@ -1482,7 +1482,10 @@ func (jm *Controller) manageJob(ctx context.Context, job *batch.Job, activePods
if completionIndex != unknownCompletionIndex {
template = podTemplate.DeepCopy()
addCompletionIndexAnnotation(template, completionIndex)
addCompletionIndexLabel(template, completionIndex)
if feature.DefaultFeatureGate.Enabled(features.PodIndexLabel) {
addCompletionIndexLabel(template, completionIndex)
}
template.Spec.Hostname = fmt.Sprintf("%s-%d", job.Name, completionIndex)
generateName = podGenerateNameWithIndex(job.Name, completionIndex)
}