From 3fcf28abf788d143353b62dafe4b1a197e900395 Mon Sep 17 00:00:00 2001 From: Martin Sivak Date: Tue, 10 Mar 2026 15:41:25 +0100 Subject: [PATCH] OCPBUGS-62277: Requeue PerformanceStatus update when status write fails The old code logged an error when not able to save status, but it never retried. This caused stale conditions to be reported until the next reconcile (possibly long time in the future). --- .../controller/performanceprofile_controller.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/performanceprofile/controller/performanceprofile_controller.go b/pkg/performanceprofile/controller/performanceprofile_controller.go index 98150f63e5..59adb46907 100644 --- a/pkg/performanceprofile/controller/performanceprofile_controller.go +++ b/pkg/performanceprofile/controller/performanceprofile_controller.go @@ -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 @@ -504,13 +507,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 } return ctrl.Result{}, nil } @@ -540,7 +544,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 } @@ -549,7 +553,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 }