Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ import (
const (
openshiftFinalizer = "foreground-deletion"
hypershiftFinalizer = "hypershift.openshift.io/foreground-deletion"

// statusUpdateRequeueAfter is the delay before retrying reconcile after a failure to update performance profile status.
statusUpdateRequeueAfter = 30 * time.Second
)

// PerformanceProfileReconciler reconciles a PerformanceProfile object
Expand Down Expand Up @@ -502,13 +505,14 @@ func (r *PerformanceProfileReconciler) Reconcile(ctx context.Context, req ctrl.R
conditions := status.GetDegradedConditions(status.ConditionReasonComponentsCreationFailed, err.Error())
if err := r.StatusWriter.Update(ctx, instance, conditions); err != nil {
klog.Errorf("failed to update performance profile %q status: %v", instance.GetName(), err)
return reconcile.Result{}, err
return reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, nil
}
return reconcile.Result{}, err
}
err = r.StatusWriter.UpdateOwnedConditions(ctx, instance)
if err != nil {
klog.Errorf("failed to update performance profile %q status: %v", instance.GetName(), err)
return ctrl.Result{RequeueAfter: statusUpdateRequeueAfter}, nil
}
Comment on lines 506 to 516
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Requeueafter ignored with error 🐞 Bug ≡ Correctness

Reconcile returns (Result{RequeueAfter: statusUpdateRequeueAfter}, err) on status update
failures, but controller-runtime ignores any non-zero Result when err != nil and requeues using
exponential backoff instead of the intended 30s delay. This breaks the PR’s stated goal and can
cause immediate/repeated retries rather than the fixed retry delay.
Agent Prompt
### Issue description
The reconciler currently returns `Result{RequeueAfter: ...}` together with a non-nil `err` in status-write failure paths. In controller-runtime, `Result` is ignored when `err != nil`, so the requested 30s delay is not applied.

### Issue Context
Goal is to retry reconciliation after a status update failure with a fixed delay (30s) so status doesn’t remain stale, without triggering immediate rate-limited retries.

### Fix Focus Areas
- pkg/performanceprofile/controller/performanceprofile_controller.go[502-517]

### Suggested change
- In the status update failure branches, change returns from `return ctrl/reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, err` to `return ctrl.Result{RequeueAfter: statusUpdateRequeueAfter}, nil` (keeping the existing log line so the failure is still visible).
- Ensure any other requeue-after paths do not return a non-nil error if the delay must be honored.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Copy Markdown
Contributor

@jmencak jmencak Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, CodeRabbit didn't catch this @MarSik , looks like there's some value in Qodo.

Edit: CodeRabbit AI found it too.

return ctrl.Result{}, nil
}
Expand Down Expand Up @@ -538,7 +542,7 @@ func (r *PerformanceProfileReconciler) getAndValidateMCP(ctx context.Context, in
conditions := status.GetDegradedConditions(status.ConditionFailedToFindMachineConfigPool, err.Error())
if err := r.StatusWriter.Update(ctx, profile, conditions); err != nil {
klog.Errorf("failed to update performance profile %q status: %v", profile.GetName(), err)
return nil, &reconcile.Result{}, err
return nil, &reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, nil
}
return nil, &reconcile.Result{}, nil
}
Expand All @@ -547,7 +551,7 @@ func (r *PerformanceProfileReconciler) getAndValidateMCP(ctx context.Context, in
conditions := status.GetDegradedConditions(status.ConditionBadMachineConfigLabels, err.Error())
if err := r.StatusWriter.Update(ctx, profile, conditions); err != nil {
klog.Errorf("failed to update performance profile %q status: %v", profile.GetName(), err)
return nil, &reconcile.Result{}, err
return nil, &reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, nil
}
return nil, &reconcile.Result{}, nil
}
Expand Down