Skip to content

Commit

Permalink
Merge pull request #111038 from alculquicondor/automated-cherry-pick-…
Browse files Browse the repository at this point in the history
…of-#111026-upstream-release-1.23

Automated cherry pick of #111026: Do not skip job requeue in conflict error
  • Loading branch information
k8s-ci-robot committed Jul 12, 2022
2 parents 01f80ae + 71a4c69 commit 9d48d98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 1 addition & 6 deletions pkg/controller/job/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,7 @@ func (jm *Controller) processNextWorkItem(ctx context.Context) bool {
}

utilruntime.HandleError(fmt.Errorf("syncing job: %w", err))
if !apierrors.IsConflict(err) {
// If this was a conflict error, we expect a Job or Pod update event, which
// will add the job back to the queue. Avoiding the rate limited requeue
// saves an unnecessary sync.
jm.queue.AddRateLimited(key)
}
jm.queue.AddRateLimited(key)

return true
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller/job/job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1997,11 +1997,13 @@ func TestSyncJobUpdateRequeue(t *testing.T) {
wantRequeue: true,
},
"conflict error": {
updateErr: apierrors.NewConflict(schema.GroupResource{}, "", nil),
updateErr: apierrors.NewConflict(schema.GroupResource{}, "", nil),
wantRequeue: true,
},
"conflict error, with finalizers": {
withFinalizers: true,
updateErr: apierrors.NewConflict(schema.GroupResource{}, "", nil),
wantRequeue: true,
},
}
for name, tc := range cases {
Expand Down

0 comments on commit 9d48d98

Please sign in to comment.