Skip to content

Commit

Permalink
Deletes Bundles after deleting all its BundleDeployments
Browse files Browse the repository at this point in the history
When testing #2586 the `Bundle` reconciler found
that the `Bundle` was gone as was trying to delete the same `BundleDeployments` in parallel.

Deleting the `Bundle` after deleting all its `BundleDeployments` seems to help to prevent that race condition
between both reconcilers

Refers to: #2586

Signed-off-by: Xavi Garcia <[email protected]>
  • Loading branch information
0xavi0 committed Jul 3, 2024
1 parent 085a09b commit 37da223
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/cmd/controller/finalize/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37da223

Please sign in to comment.