From 74c4f92a60a2ce400a56bf25ecf5f7c262dfc557 Mon Sep 17 00:00:00 2001 From: Paulina Osikoya Date: Wed, 6 May 2026 13:52:02 +0100 Subject: [PATCH] requeue logic for pending NAD The operator currently returns a misleading reconcile error when Pod interfaces are not yet ready with assigned IPs. This change introduces a requeue mechanism to allow time for NetworkAttachmentDefinitions (NAD) to be fully provisioned. --- internal/controller/common.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/internal/controller/common.go b/internal/controller/common.go index 30acd326..2d681ed6 100644 --- a/internal/controller/common.go +++ b/internal/controller/common.go @@ -694,6 +694,7 @@ func (r *Reconciler) VerifyNetworkAttachments( conditions *condition.Conditions, networkAttachmentStatus *map[string][]string, ) (ctrl.Result, error) { + Log := r.GetLogger(ctx) pod, err := r.GetPodIfExists(ctx, instance, workflowStepIndex) if pod == nil { return ctrl.Result{}, err @@ -718,14 +719,33 @@ func (r *Reconciler) VerifyNetworkAttachments( condition.NetworkAttachmentsReadyMessage) } else { err := fmt.Errorf("%w: %s", ErrNetworkAttachmentsMismatch, networkAttachments) + + // maxWaitTime to wait for NAD that should escalate to a hard error + const maxWaitTime = 5 * time.Minute + elaspedTime := time.Since(pod.GetCreationTimestamp().Time) + if elaspedTime > maxWaitTime { + conditions.Set(condition.FalseCondition( + condition.NetworkAttachmentsReadyCondition, + condition.ErrorReason, + condition.SeverityError, + condition.NetworkAttachmentsReadyErrorMessage, + fmt.Errorf("timed out waiting for network attachments: %w", err).Error())) + + return ctrl.Result{}, err + } + conditions.Set(condition.FalseCondition( condition.NetworkAttachmentsReadyCondition, - condition.ErrorReason, + "NetworkAttachmentsWaiting", condition.SeverityWarning, condition.NetworkAttachmentsReadyErrorMessage, err.Error())) - return ctrl.Result{}, err + Log.Info("Waiting for network attachments to become ready", + "elaspedTime", elaspedTime, + "maxWaitTime", maxWaitTime) + + return ctrl.Result{RequeueAfter: time.Second * 10}, nil } return ctrl.Result{}, nil