From 2ad3e4baabbc4c902c75bc8715420c97fbba2156 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 10 Oct 2024 18:12:14 +0200 Subject: [PATCH] Make sure to log error in findObjectsForSrc() It is hidden right now if there is an error in configured named fields and index. Lets log the error and return the current state of requests. With this the findObjectsForSrc() will exit with an hidden error like: ``` "error": "Index with name field:.spec.ksmTls.caBundleSecretName does not exist" ``` Signed-off-by: Martin Schuppert --- controllers/swiftproxy_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/swiftproxy_controller.go b/controllers/swiftproxy_controller.go index e4b81eb..c4510c4 100644 --- a/controllers/swiftproxy_controller.go +++ b/controllers/swiftproxy_controller.go @@ -803,7 +803,8 @@ func (r *SwiftProxyReconciler) findObjectsForSrc(ctx context.Context, src client } err := r.List(ctx, crList, listOps) if err != nil { - return []reconcile.Request{} + l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace())) + return requests } for _, item := range crList.Items {