Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Commit 29c1a5c

Browse files
committed
Return nil error in case NotFound and to use RequeueAfter
Currently the reconciler returned both a non-zero result and a non-nil error. The result will always be ignored if the error is non-nil and the non-nil error causes reqeueuing with exponential backoff. In case of NotFound return nil that the ReqeueAfter is used. For more details, see: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler Signed-off-by: Martin Schuppert <[email protected]>
1 parent 135e3b0 commit 29c1a5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/openstack_ansibleee_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ func (r *OpenStackAnsibleEEReconciler) Reconcile(ctx context.Context, req ctrl.R
150150
_, err := nad.GetNADWithName(ctx, helper, netAtt, instance.Namespace)
151151
if err != nil {
152152
if errors.IsNotFound(err) {
153+
Log.Info(fmt.Sprintf("network-attachment-definition %s not found", netAtt))
153154
instance.Status.Conditions.Set(condition.FalseCondition(
154155
condition.NetworkAttachmentsReadyCondition,
155156
condition.RequestedReason,
156157
condition.SeverityInfo,
157158
condition.NetworkAttachmentsReadyWaitingMessage,
158159
netAtt))
159-
return ctrl.Result{RequeueAfter: time.Second * 10}, fmt.Errorf("network-attachment-definition %s not found", netAtt)
160+
return ctrl.Result{RequeueAfter: time.Second * 10}, nil
160161
}
161162
instance.Status.Conditions.Set(condition.FalseCondition(
162163
condition.NetworkAttachmentsReadyCondition,

0 commit comments

Comments
 (0)