Fix noisy reconcile errors (#275)

Certain errors are better ignored to instead rely on the child resource
to trigger a new reconcile.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Enhanced error handling in group resolution to prevent silent failures
and ensure proper error notification
* Improved system resilience by gracefully handling missing or
unavailable Kubernetes resources without triggering reconciliation
failures
* Optimized setup key processing workflow to enhance overall system
robustness and reliability

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/netbirdio/kubernetes-operator/pull/275?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Philip Laine
2026-05-29 09:58:14 +02:00
committed by GitHub
parent dcd9dfdb4e
commit c5eaa832d3
3 changed files with 10 additions and 8 deletions
@@ -126,7 +126,7 @@ func (r *NetworkRouterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}
err = r.Client.Get(ctx, client.ObjectKeyFromObject(group), group)
if err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}
if group.Status.GroupID == "" {
return ctrl.Result{}, nil
@@ -153,7 +153,7 @@ func (r *NetworkRouterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}
err = r.Get(ctx, client.ObjectKeyFromObject(&setupKey), &setupKey)
if err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}
if setupKey.Status.SetupKeyID == "" {
return ctrl.Result{}, nil
@@ -379,7 +379,7 @@ func (r *NetworkRouterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}
err = r.Client.Get(ctx, client.ObjectKeyFromObject(dep), dep)
if err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}
if dep.Status.ReadyReplicas != dep.Status.Replicas {
return ctrl.Result{}, nil