Fix: TaskRuns stuck blocked from deletion due to old chains finaliser#1756
Conversation
Chains v.0.27.0 started to use Service-Side-Apply mechanism to manage finalisers. SSA mechanism cannot modify finalisers previously added by merge patch method. As a result, deletion of TaskRuns that were triggered before the Chains update and got old finalisers is blocked forever. This change is updating the existing `removeOldFinalizerIfExists` function to call `removeFinalizerViaMergePatch` to cleanup the old finaliser and allow future deletion of a TaskRun. Fixes: tektoncd#1755 Signed-off-by: Liu-ko <t.iljushenko@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@enarha Can you review please ? |
There was a problem hiding this comment.
Thank you for the fix. I'll suggest the following instead. Since finalizer with the old name is guaranteed to be set via merge patch, we can simply use the removeFinalizerViaMergePatch function for it. Something like this will be sufficient IMO
func (r *Reconciler) removeFinalizerViaMergePatch(ctx context.Context, tr *v1.TaskRun) error {
const oldFinalizerName = "chains.tekton.dev" // add the const
var newFinalizers []string
for _, f := range tr.Finalizers {
if f != taskRunFinalizerName && f != oldFinalizerName { // one extra condition
newFinalizers = append(newFinalizers, f)
}
}
// ... unchanged
This only adds the const and the extra f != oldFinalizerName condition. Then we can drop the removeOldFinalizerIfExists function and its calls entirely. I would also like to have an extra test for this case.
On a separate note, can you please add a short release note as I would like to see it included in the release notes.
Chains v.0.27.0 started to use Service-Side-Apply mechanism to manage finalisers. SSA mechanism cannot modify finalisers previously added by merge patch method. As a result, deletion of TaskRuns that were triggered before the Chains update and got old finalisers is blocked forever.
This change is updating the existing
removeOldFinalizerIfExistsfunction to callremoveFinalizerViaMergePatchto cleanup the old finaliser and allow future deletion of a TaskRun.Fixes: #1755
Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes