Skip to content

Commit

Permalink
fix delete gc-artifact workflow stuck due to finalizers can not be …
Browse files Browse the repository at this point in the history
…removed

Signed-off-by: joey <[email protected]>
  • Loading branch information
chengjoey committed Aug 26, 2024
1 parent dcd9436 commit 287d5f5
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions workflow/controller/artifact_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand All @@ -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)
Expand Down

0 comments on commit 287d5f5

Please sign in to comment.