diff --git a/api/v1/gwendpointslice_types.go b/api/v1/gwendpointslice_types.go index 462e3e0..de639c6 100644 --- a/api/v1/gwendpointslice_types.go +++ b/api/v1/gwendpointslice_types.go @@ -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) } } } diff --git a/controllers/gwendpointslice_controller.go b/controllers/gwendpointslice_controller.go index 0433543..b2a4172 100644 --- a/controllers/gwendpointslice_controller.go +++ b/controllers/gwendpointslice_controller.go @@ -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