mirror of
https://github.com/netbirdio/kubernetes-operator.git
synced 2026-05-22 17:11:40 -07:00
Fix returning ctrl.Result and error preventing backoff (#50)
This commit is contained in:
@@ -53,6 +53,12 @@ func (r *NBGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
|
||||
|
||||
originalGroup := nbGroup.DeepCopy()
|
||||
defer func() {
|
||||
if err != nil {
|
||||
// double check result is nil, otherwise error is not printed
|
||||
// and exponential backoff doesn't work properly
|
||||
res = ctrl.Result{}
|
||||
return
|
||||
}
|
||||
if !originalGroup.Status.Equal(nbGroup.Status) {
|
||||
updateErr := r.Client.Status().Update(ctx, &nbGroup)
|
||||
if updateErr != nil {
|
||||
|
||||
@@ -210,6 +210,12 @@ func (r *NBPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (r
|
||||
originalPolicy := nbPolicy.DeepCopy()
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
// double check result is nil, otherwise error is not printed
|
||||
// and exponential backoff doesn't work properly
|
||||
res = ctrl.Result{}
|
||||
return
|
||||
}
|
||||
if originalPolicy.DeletionTimestamp != nil && len(nbPolicy.Finalizers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ func (r *NBResourceReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
||||
originalResource := nbResource.DeepCopy()
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
// double check result is nil, otherwise error is not printed
|
||||
// and exponential backoff doesn't work properly
|
||||
res = ctrl.Result{}
|
||||
return
|
||||
}
|
||||
if originalResource.DeletionTimestamp != nil && len(nbResource.Finalizers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@ func (r *NBRoutingPeerReconciler) Reconcile(ctx context.Context, req ctrl.Reques
|
||||
|
||||
originalNBRP := nbrp.DeepCopy()
|
||||
defer func() {
|
||||
if err != nil {
|
||||
// double check result is nil, otherwise error is not printed
|
||||
// and exponential backoff doesn't work properly
|
||||
res = ctrl.Result{}
|
||||
return
|
||||
}
|
||||
if originalNBRP.DeletionTimestamp != nil && len(nbrp.Finalizers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user