@@ -792,12 +792,7 @@ func (jm *Controller) syncJob(ctx context.Context, key string) (rErr error) {
792
792
var manageJobErr error
793
793
var finishedCondition * batch.JobCondition
794
794
795
- jobHasNewFailure := failed > job .Status .Failed
796
- // new failures happen when status does not reflect the failures and active
797
- // is different than parallelism, otherwise the previous controller loop
798
- // failed updating status so even if we pick up failure it is not a new one
799
- exceedsBackoffLimit := jobHasNewFailure && (active != * job .Spec .Parallelism ) &&
800
- (failed > * job .Spec .BackoffLimit )
795
+ exceedsBackoffLimit := failed > * job .Spec .BackoffLimit
801
796
802
797
if feature .DefaultFeatureGate .Enabled (features .JobPodFailurePolicy ) {
803
798
if failureTargetCondition := findConditionByType (job .Status .Conditions , batch .JobFailureTarget ); failureTargetCondition != nil {
@@ -999,6 +994,7 @@ func (jm *Controller) trackJobStatusAndRemoveFinalizers(ctx context.Context, job
999
994
needsFlush = true
1000
995
}
1001
996
podFailureCountByPolicyAction := map [string ]int {}
997
+ reachedMaxUncountedPods := false
1002
998
for _ , pod := range pods {
1003
999
if ! hasJobTrackingFinalizer (pod ) || expectedRmFinalizers .Has (string (pod .UID )) {
1004
1000
// This pod was processed in a previous sync.
@@ -1049,6 +1045,7 @@ func (jm *Controller) trackJobStatusAndRemoveFinalizers(ctx context.Context, job
1049
1045
//
1050
1046
// The job will be synced again because the Job status and Pod updates
1051
1047
// will put the Job back to the work queue.
1048
+ reachedMaxUncountedPods = true
1052
1049
break
1053
1050
}
1054
1051
}
@@ -1077,7 +1074,7 @@ func (jm *Controller) trackJobStatusAndRemoveFinalizers(ctx context.Context, job
1077
1074
if job , needsFlush , err = jm .flushUncountedAndRemoveFinalizers (ctx , job , podsToRemoveFinalizer , uidsWithFinalizer , & oldCounters , podFailureCountByPolicyAction , needsFlush , newBackoffRecord ); err != nil {
1078
1075
return err
1079
1076
}
1080
- jobFinished := jm .enactJobFinished (job , finishedCond )
1077
+ jobFinished := ! reachedMaxUncountedPods && jm .enactJobFinished (job , finishedCond )
1081
1078
if jobFinished {
1082
1079
needsFlush = true
1083
1080
}
0 commit comments