diff --git a/internal/cmd/controller/finalize/finalize.go b/internal/cmd/controller/finalize/finalize.go index 9af3a24879..056677c536 100644 --- a/internal/cmd/controller/finalize/finalize.go +++ b/internal/cmd/controller/finalize/finalize.go @@ -50,15 +50,15 @@ func PurgeBundles(ctx context.Context, c client.Client, gitrepo types.Namespaced } for _, bundle := range bundles.Items { - err := c.Delete(ctx, &bundle) - if client.IgnoreNotFound(err) != nil { - return err - } - nn := types.NamespacedName{Namespace: bundle.Namespace, Name: bundle.Name} if err = PurgeBundleDeployments(ctx, c, nn); err != nil { return client.IgnoreNotFound(err) } + + err := c.Delete(ctx, &bundle) + if client.IgnoreNotFound(err) != nil { + return err + } } return nil