From 990611792855957454bff809254440ad8cec46e1 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 10 Oct 2024 17:55:09 +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/manilaapi_controller.go | 3 ++- controllers/manilascheduler_controller.go | 3 ++- controllers/manilashare_controller.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/controllers/manilaapi_controller.go b/controllers/manilaapi_controller.go index 3c12b1a9..292009e5 100644 --- a/controllers/manilaapi_controller.go +++ b/controllers/manilaapi_controller.go @@ -340,7 +340,8 @@ func (r *ManilaAPIReconciler) 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 { diff --git a/controllers/manilascheduler_controller.go b/controllers/manilascheduler_controller.go index aea7fc2f..31e09f93 100644 --- a/controllers/manilascheduler_controller.go +++ b/controllers/manilascheduler_controller.go @@ -284,7 +284,8 @@ func (r *ManilaSchedulerReconciler) findObjectsForSrc(ctx context.Context, src c } 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/manilashare_controller.go b/controllers/manilashare_controller.go index 5d7de08e..aa22b5c8 100644 --- a/controllers/manilashare_controller.go +++ b/controllers/manilashare_controller.go @@ -284,7 +284,8 @@ func (r *ManilaShareReconciler) findObjectsForSrc(ctx context.Context, src clien } 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 {