Skip to content

Commit 2e30199

Browse files
committed
fix: Cleanup logic, around hub cleanup
1 parent 8dd3dd7 commit 2e30199

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

internal/controller/pattern_controller.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -619,27 +619,20 @@ func (r *PatternReconciler) finalizeObject(instance *api.Pattern) error {
619619
return fmt.Errorf("deleted %d managed cluster(s), waiting for removal to complete before proceeding with hub deletion", deletedCount)
620620
}
621621

622-
return fmt.Errorf("No managed clusters found (excluding local-cluster), waiting for removal of acm hub before proceeding with hub deletion")
623-
624-
}
625-
626-
// Update application with deletePattern=1 to trigger hub deletion
627-
if changed, _ := updateApplication(r.argoClient, targetApp, app, ns); changed {
628-
return fmt.Errorf("updated application %q for hub deletion", app.Name)
629-
}
622+
// Update application with deletePattern=1 to trigger hub deletion
623+
if changed, _ := updateApplication(r.argoClient, targetApp, app, ns); changed {
624+
return fmt.Errorf("updated application %q for hub deletion", app.Name)
625+
}
630626

631-
if app.Status.Sync.Status == argoapi.SyncStatusCodeOutOfSync {
632627
inProgress, err := syncApplicationWithPrune(r.argoClient, app, ns)
633628
if err != nil {
634629
return err
635630
}
636631
if inProgress {
637632
return fmt.Errorf("sync with prune and force is already in progress for application %q", app.Name)
638633
}
639-
}
640634

641-
if app.Status.Sync.Status == argoapi.SyncStatusCodeOutOfSync {
642-
return fmt.Errorf("application %q is still %s", app.Name, argoapi.SyncStatusCodeOutOfSync)
635+
return fmt.Errorf("waiting for removal of that acm hub")
643636
}
644637

645638
log.Printf("Removing the application, and cascading to anything instantiated by ArgoCD")

0 commit comments

Comments
 (0)