@@ -896,6 +896,9 @@ func (jm *Controller) syncJob(ctx context.Context, key string) (rErr error) {
896
896
jobCtx .finishedCondition = nil
897
897
}
898
898
active -= deleted
899
+ if feature .DefaultFeatureGate .Enabled (features .JobPodReplacementPolicy ) {
900
+ * jobCtx .terminating += deleted
901
+ }
899
902
manageJobErr = err
900
903
} else {
901
904
manageJobCalled := false
@@ -1501,6 +1504,9 @@ func (jm *Controller) manageJob(ctx context.Context, job *batch.Job, jobCtx *syn
1501
1504
jm .expectations .ExpectDeletions (logger , jobKey , len (podsToDelete ))
1502
1505
removed , err := jm .deleteJobPods (ctx , job , jobKey , podsToDelete )
1503
1506
active -= removed
1507
+ if feature .DefaultFeatureGate .Enabled (features .JobPodReplacementPolicy ) {
1508
+ * jobCtx .terminating += removed
1509
+ }
1504
1510
return active , metrics .JobSyncActionPodsDeleted , err
1505
1511
}
1506
1512
@@ -1550,6 +1556,9 @@ func (jm *Controller) manageJob(ctx context.Context, job *batch.Job, jobCtx *syn
1550
1556
logger .V (4 ).Info ("Too many pods running for job" , "job" , klog .KObj (job ), "deleted" , len (podsToDelete ), "target" , wantActive )
1551
1557
removed , err := jm .deleteJobPods (ctx , job , jobKey , podsToDelete )
1552
1558
active -= removed
1559
+ if feature .DefaultFeatureGate .Enabled (features .JobPodReplacementPolicy ) {
1560
+ * jobCtx .terminating += removed
1561
+ }
1553
1562
// While it is possible for a Job to require both pod creations and
1554
1563
// deletions at the same time (e.g. indexed Jobs with repeated indexes), we
1555
1564
// restrict ourselves to either just pod deletion or pod creation in any
0 commit comments