Skip to content

Commit

Permalink
Make sure to log error in findObjectsForSrc()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stuggi committed Oct 10, 2024
1 parent c5389f5 commit 1882cf2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion controllers/designateapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ func (r *DesignateAPIReconciler) findObjectsForSrc(ctx context.Context, src clie
}
err := r.Client.List(context.TODO(), 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 {
Expand Down
3 changes: 2 additions & 1 deletion controllers/designatecentral_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ func (r *DesignateCentralReconciler) findObjectsForSrc(ctx context.Context, src
}
err := r.Client.List(context.TODO(), 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 {
Expand Down
3 changes: 2 additions & 1 deletion controllers/designatemdns_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func (r *DesignateMdnsReconciler) findObjectsForSrc(ctx context.Context, src cli
}
err := r.Client.List(context.TODO(), 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 {
Expand Down
3 changes: 2 additions & 1 deletion controllers/designateproducer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func (r *DesignateProducerReconciler) findObjectsForSrc(ctx context.Context, src
}
err := r.Client.List(context.TODO(), 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 {
Expand Down
3 changes: 2 additions & 1 deletion controllers/designateworker_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func (r *DesignateWorkerReconciler) findObjectsForSrc(ctx context.Context, src c
}
err := r.Client.List(context.TODO(), 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 {
Expand Down

0 comments on commit 1882cf2

Please sign in to comment.