add feature gate
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -962,7 +962,9 @@ func checkIndexedJobPods(t *testing.T, control *controller.FakePodControl, wantI
|
||||
gotIndexes := sets.New[int]()
|
||||
for _, p := range control.Templates {
|
||||
checkJobCompletionEnvVariable(t, &p.Spec)
|
||||
checkJobCompletionLabel(t, &p)
|
||||
if feature.DefaultFeatureGate.Enabled(features.PodIndexLabel) {
|
||||
checkJobCompletionLabel(t, &p)
|
||||
}
|
||||
ix := getCompletionIndex(p.Annotations)
|
||||
if ix == -1 {
|
||||
t.Errorf("Created pod %s didn't have completion index", p.Name)
|
||||
@@ -4395,6 +4397,7 @@ func TestFinalizersRemovedExpectations(t *testing.T) {
|
||||
t.Errorf("Timeout waiting for expectations (-want, +got):\n%s", diff)
|
||||
}
|
||||
}
|
||||
|
||||
func checkJobCompletionLabel(t *testing.T, p *v1.PodTemplateSpec) {
|
||||
t.Helper()
|
||||
labels := p.GetLabels()
|
||||
|
Reference in New Issue
Block a user