From d5dd3626e81f6b18921da1100690f332e8ebd9c5 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 10 Oct 2024 17:42:15 +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/glance_controller.go | 3 ++- controllers/glanceapi_controller.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/glance_controller.go b/controllers/glance_controller.go index 53e07969..4bbbb46c 100644 --- a/controllers/glance_controller.go +++ b/controllers/glance_controller.go @@ -279,7 +279,8 @@ func (r *GlanceReconciler) findObjectsForSrc(ctx context.Context, src client.Obj } 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 { diff --git a/controllers/glanceapi_controller.go b/controllers/glanceapi_controller.go index 681509ce..13c4a20b 100644 --- a/controllers/glanceapi_controller.go +++ b/controllers/glanceapi_controller.go @@ -365,7 +365,8 @@ func (r *GlanceAPIReconciler) 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 {