Revert "Limit number of Pods counted in a single Job sync"
This reverts commit 7d9cb88fed
.
This commit is contained in:
@@ -880,8 +880,8 @@ func (jm *Controller) removeTrackingFinalizersFromAllPods(pods []*v1.Pod) error
|
||||
// or the job was removed.
|
||||
// 3. Increment job counters for pods that no longer have a finalizer.
|
||||
// 4. Add Complete condition if satisfied with current counters.
|
||||
// It does this up to a limited number of Pods so that the size of .status
|
||||
// doesn't grow too much and this sync doesn't starve other Jobs.
|
||||
// It does this in a controlled way such that the size of .status doesn't grow
|
||||
// too much.
|
||||
func (jm *Controller) trackJobStatusAndRemoveFinalizers(job *batch.Job, pods []*v1.Pod, succeededIndexes orderedIntervals, uncounted uncountedTerminatedPods, finishedCond *batch.JobCondition, needsFlush bool) error {
|
||||
isIndexed := isIndexedJob(job)
|
||||
var podsToRemoveFinalizer []*v1.Pod
|
||||
@@ -936,15 +936,17 @@ func (jm *Controller) trackJobStatusAndRemoveFinalizers(job *batch.Job, pods []*
|
||||
}
|
||||
}
|
||||
if len(newSucceededIndexes)+len(uncountedStatus.Succeeded)+len(uncountedStatus.Failed) >= maxUncountedPods {
|
||||
// The controller added enough Pods already to .status.uncountedTerminatedPods
|
||||
// We stop counting pods and removing finalizers here to:
|
||||
// 1. Ensure that the UIDs representation are under 20 KB.
|
||||
// 2. Cap the number of finalizer removals so that syncing of big Jobs
|
||||
// doesn't starve smaller ones.
|
||||
//
|
||||
// The job will be synced again because the Job status and Pod updates
|
||||
// will put the Job back to the work queue.
|
||||
break
|
||||
if len(newSucceededIndexes) > 0 {
|
||||
succeededIndexes = succeededIndexes.withOrderedIndexes(newSucceededIndexes)
|
||||
job.Status.Succeeded = int32(succeededIndexes.total())
|
||||
job.Status.CompletedIndexes = succeededIndexes.String()
|
||||
}
|
||||
var err error
|
||||
if needsFlush, err = jm.flushUncountedAndRemoveFinalizers(job, podsToRemoveFinalizer, uidsWithFinalizer, needsFlush); err != nil {
|
||||
return err
|
||||
}
|
||||
podsToRemoveFinalizer = nil
|
||||
newSucceededIndexes = nil
|
||||
}
|
||||
}
|
||||
if len(newSucceededIndexes) > 0 {
|
||||
|
@@ -1463,7 +1463,7 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
|
||||
pods = append(pods, buildPod().uid("b").phase(v1.PodFailed).trackingFinalizer().Pod)
|
||||
return pods
|
||||
}(),
|
||||
wantRmFinalizers: 499,
|
||||
wantRmFinalizers: 501,
|
||||
wantStatusUpdates: []batch.JobStatus{
|
||||
{
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{
|
||||
@@ -1480,11 +1480,17 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
|
||||
},
|
||||
{
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{
|
||||
Failed: []types.UID{"b"},
|
||||
Succeeded: []types.UID{"499"},
|
||||
Failed: []types.UID{"b"},
|
||||
},
|
||||
Succeeded: 499,
|
||||
Failed: 1,
|
||||
},
|
||||
{
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{},
|
||||
Succeeded: 500,
|
||||
Failed: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
"too many indexed finished": {
|
||||
@@ -1501,13 +1507,18 @@ func TestTrackJobStatusAndRemoveFinalizers(t *testing.T) {
|
||||
}
|
||||
return pods
|
||||
}(),
|
||||
wantRmFinalizers: 500,
|
||||
wantRmFinalizers: 501,
|
||||
wantStatusUpdates: []batch.JobStatus{
|
||||
{
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{},
|
||||
CompletedIndexes: "0-499",
|
||||
Succeeded: 500,
|
||||
},
|
||||
{
|
||||
CompletedIndexes: "0-500",
|
||||
UncountedTerminatedPods: &batch.UncountedTerminatedPods{},
|
||||
Succeeded: 501,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user