Skip to content

Commit

Permalink
Add missing 404 guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Olshevski committed Jan 2, 2024
1 parent 8d536da commit a048ff3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/controllers/reconciliation/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"github.com/go-logr/logr"
)

// TODO: There's a 404 missing exclude somewhere

// TODO: Block ResourceSlice deletion until resources have been cleaned up
// TODO: Clean up unused resource slices older than a duration

Expand Down Expand Up @@ -63,7 +61,7 @@ func (c *Controller) Reconcile(ctx context.Context, req *reconstitution.Request)
comp := &apiv1.Composition{}
err := c.client.Get(ctx, req.Composition, comp)
if err != nil {
return ctrl.Result{}, fmt.Errorf("getting composition: %w", err)
return ctrl.Result{}, client.IgnoreNotFound(fmt.Errorf("getting composition: %w", err))
}

if comp.Status.CurrentState == nil {
Expand All @@ -78,6 +76,7 @@ func (c *Controller) Reconcile(ctx context.Context, req *reconstitution.Request)
if !exists {
// It's possible for the cache to be empty because a manifest for this resource no longer exists at the requested composition generation.
// Dropping the work item is safe since filling the new version will generate a new queue message.
logger.V(1).Info("dropping work item because the corresponding manifest generation no longer exists in the cache")
return ctrl.Result{}, nil
}

Expand Down

0 comments on commit a048ff3

Please sign in to comment.