From 1e0f57362857f82a2a30c14380f08072ae40cf3e 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 16381969a..4376c1a18 100644 --- a/pkg/performanceprofile/controller/performanceprofile_controller.go +++ b/pkg/performanceprofile/controller/performanceprofile_controller.go @@ -62,6 +62,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 @@ -615,13 +618,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 } @@ -651,7 +655,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 } @@ -660,7 +664,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 }