From b0b572db4863682ddefbce3f06dd96c8a5b38faa Mon Sep 17 00:00:00 2001 From: Alex Vulaj Date: Wed, 15 Apr 2026 11:55:44 -0400 Subject: [PATCH] Tear down operator sequentially after Central/SecuredCluster --- internal/deployer/deployer.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/internal/deployer/deployer.go b/internal/deployer/deployer.go index 5d8ce002..6597cd27 100644 --- a/internal/deployer/deployer.go +++ b/internal/deployer/deployer.go @@ -687,18 +687,16 @@ func (d *Deployer) Teardown(ctx context.Context, components component.Component) } }() - // For 'all', also tear down the operator in parallel + wg.Wait() + + // Tear down the operator strictly after Central/SecuredCluster are gone, + // because the operator manages finalizers on their custom resources. if components == component.All { - wg.Add(1) - go func() { - defer wg.Done() - if err := d.teardownOperator(ctx); err != nil { - d.logger.Warningf("Error tearing down operator: %v", err) - } - }() + if err := d.teardownOperator(ctx); err != nil { + d.logger.Warningf("Error tearing down operator: %v", err) + } } - wg.Wait() return nil default: return fmt.Errorf("unknown component: %s", components)