Skip to content

Commit

Permalink
fix: make sure Finalizers has chance to be removed. Fixes: #12836 (#1…
Browse files Browse the repository at this point in the history
…2831)

Signed-off-by: shuangkun <[email protected]>
(cherry picked from commit fb6c3d0)
  • Loading branch information
shuangkun authored and Anton Gilgur committed Apr 19, 2024
1 parent 5d03f83 commit ce7cad3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/fixtures/when.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ func (w *When) WaitForWorkflowList(listOptions metav1.ListOptions, condition fun
return w
}
}
time.Sleep(time.Second)
}
}

Expand Down
4 changes: 4 additions & 0 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ func (woc *wfOperationCtx) persistUpdates(ctx context.Context) {
woc.log.WithError(err).Warn("failed to delete task-results")
}
}
// If Finalizer exists, requeue to make sure Finalizer can be removed.
if woc.wf.Status.Fulfilled() && len(wf.GetFinalizers()) > 0 {
woc.requeueAfter(5 * time.Second)
}

// It is important that we *never* label pods as completed until we successfully updated the workflow
// Failing to do so means we can have inconsistent state.
Expand Down

0 comments on commit ce7cad3

Please sign in to comment.