From 287d5f5c91b1ee620e561e0ca27f59954f8d4429 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 24 Aug 2024 18:03:41 +0800 Subject: [PATCH] fix delete gc-artifact workflow stuck due to `finalizers` can not be removed Signed-off-by: joey --- workflow/controller/artifact_gc.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/workflow/controller/artifact_gc.go b/workflow/controller/artifact_gc.go index cc98a422d7dd..3da197fb119b 100644 --- a/workflow/controller/artifact_gc.go +++ b/workflow/controller/artifact_gc.go @@ -508,7 +508,6 @@ func (woc *wfOperationCtx) processArtifactGCCompletion(ctx context.Context) erro return fmt.Errorf("failed to get pods from informer: %w", err) } - anyPodSuccess := false for _, obj := range pods { pod := obj.(*corev1.Pod) if pod.Labels[common.LabelKeyComponent] != artifactGCComponent { // make sure it's an Artifact GC Pod @@ -535,9 +534,6 @@ func (woc *wfOperationCtx) processArtifactGCCompletion(ctx context.Context) erro return err } woc.wf.Status.ArtifactGCStatus.SetArtifactGCPodRecouped(pod.Name, true) - if phase == corev1.PodSucceeded { - anyPodSuccess = true - } woc.updated = true } } @@ -548,7 +544,7 @@ func (woc *wfOperationCtx) processArtifactGCCompletion(ctx context.Context) erro removeFinalizer = woc.wf.Status.ArtifactGCStatus.AllArtifactGCPodsRecouped() } else { // check if all artifacts have been deleted and if so remove Finalizer - removeFinalizer = anyPodSuccess && woc.allArtifactsDeleted() + removeFinalizer = woc.allArtifactsDeleted() } if removeFinalizer { woc.log.Infof("no remaining artifacts to GC, removing artifact GC finalizer (forceFinalizerRemoval=%v)", forceFinalizerRemoval)