Skip to content

Commit f874cff

Browse files
committed
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 <[email protected]>
1 parent 200b937 commit f874cff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

controllers/galera_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,8 @@ func GetDatabaseObject(ctx context.Context, clientObj client.Client, name string
985985
func (r *GaleraReconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request {
986986
requests := []reconcile.Request{}
987987

988+
l := log.FromContext(context.Background()).WithName("Controllers").WithName("Galera")
989+
988990
for _, field := range allWatchFields {
989991
crList := &mariadbv1.GaleraList{}
990992
listOps := &client.ListOptions{
@@ -993,10 +995,13 @@ func (r *GaleraReconciler) findObjectsForSrc(ctx context.Context, src client.Obj
993995
}
994996
err := r.List(ctx, crList, listOps)
995997
if err != nil {
996-
return []reconcile.Request{}
998+
l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace()))
999+
return requests
9971000
}
9981001

9991002
for _, item := range crList.Items {
1003+
l.Info(fmt.Sprintf("input source %s changed, reconcile: %s - %s", src.GetName(), item.GetName(), item.GetNamespace()))
1004+
10001005
requests = append(requests,
10011006
reconcile.Request{
10021007
NamespacedName: types.NamespacedName{

0 commit comments

Comments
 (0)