Skip to content

Commit 5588a3d

Browse files
committed
Tolerate missing GWProxies when reconciling slices
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.
1 parent e1e19da commit 5588a3d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

api/v1/gwendpointslice_types.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,15 @@ func (slice *GWEndpointSlice) ReferencingProxies(ctx context.Context, cl client.
8484
proxy := GWProxy{}
8585
proxyName := types.NamespacedName{Namespace: slice.Namespace, Name: string(parent.Name)}
8686
if err := cl.Get(ctx, proxyName, &proxy); err != nil {
87-
return refs, err
87+
// If there's an error other than "not found" then bail
88+
// out and report it. If we can't find the Proxy that's
89+
// probably because it was deleted which isn't an error.
90+
if client.IgnoreNotFound(err) != nil {
91+
return refs, err
92+
}
93+
} else {
94+
refs = append(refs, &proxy)
8895
}
89-
refs = append(refs, &proxy)
9096
}
9197
}
9298
}

controllers/gwendpointslice_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func (r *GWEndpointSliceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
4848
// and we can get them on deleted requests.
4949
return done, client.IgnoreNotFound(err)
5050
}
51+
l = l.WithValues("clientName", slice.Spec.ClientRef.Name)
5152

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

0 commit comments

Comments
 (0)