From ae263b55beb6ca15e64b811995ff5674e36e091b Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 10 Oct 2024 17:44:16 +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/heat_controller.go | 3 ++- controllers/heatapi_controller.go | 3 ++- controllers/heatcfnapi_controller.go | 3 ++- controllers/heatengine_controller.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/heat_controller.go b/controllers/heat_controller.go index 53e71e08..6caf538f 100644 --- a/controllers/heat_controller.go +++ b/controllers/heat_controller.go @@ -289,7 +289,8 @@ func (r *HeatReconciler) findObjectsForSrc(ctx context.Context, src client.Objec } 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/heatapi_controller.go b/controllers/heatapi_controller.go index 6d9de11c..02064f51 100644 --- a/controllers/heatapi_controller.go +++ b/controllers/heatapi_controller.go @@ -288,7 +288,8 @@ func (r *HeatAPIReconciler) findObjectsForSrc(ctx context.Context, src client.Ob } 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/heatcfnapi_controller.go b/controllers/heatcfnapi_controller.go index 4d826d08..5d1ff016 100644 --- a/controllers/heatcfnapi_controller.go +++ b/controllers/heatcfnapi_controller.go @@ -290,7 +290,8 @@ func (r *HeatCfnAPIReconciler) 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/heatengine_controller.go b/controllers/heatengine_controller.go index 164dcf82..4c5ff24c 100644 --- a/controllers/heatengine_controller.go +++ b/controllers/heatengine_controller.go @@ -237,7 +237,8 @@ func (r *HeatEngineReconciler) 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 {