Skip to content

Commit

Permalink
Tolerate missing GWProxies when reconciling slices
Browse files Browse the repository at this point in the history
The Gateway is very loosely coupled so it's probably a mistake to
treat missing GWProxies as an error when reconciling slices. There are
many cases where it's a temporary condition so we don't want the
controller to retry in a loop over and over.
  • Loading branch information
caboteria committed Jul 12, 2022
1 parent e1e19da commit 5588a3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/v1/gwendpointslice_types.go
Expand Up @@ -84,9 +84,15 @@ func (slice *GWEndpointSlice) ReferencingProxies(ctx context.Context, cl client.
proxy := GWProxy{}
proxyName := types.NamespacedName{Namespace: slice.Namespace, Name: string(parent.Name)}
if err := cl.Get(ctx, proxyName, &proxy); err != nil {
return refs, err
// If there's an error other than "not found" then bail
// out and report it. If we can't find the Proxy that's
// probably because it was deleted which isn't an error.
if client.IgnoreNotFound(err) != nil {
return refs, err
}
} else {
refs = append(refs, &proxy)
}
refs = append(refs, &proxy)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions controllers/gwendpointslice_controller.go
Expand Up @@ -48,6 +48,7 @@ func (r *GWEndpointSliceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
// and we can get them on deleted requests.
return done, client.IgnoreNotFound(err)
}
l = l.WithValues("clientName", slice.Spec.ClientRef.Name)

if !slice.ObjectMeta.DeletionTimestamp.IsZero() {
// This rep is marked for deletion. We need to clean up where
Expand Down

0 comments on commit 5588a3d

Please sign in to comment.