-
Notifications
You must be signed in to change notification settings - Fork 125
OCPBUGS-62277: Requeue PerformanceStatus update when status write fails #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+7
−3
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Deployment error is discarded when status update fails.
When the status update fails on line 619, line 621 returns
nilerror, discarding the original component deployment error from line 607. This causes controller-runtime to treat the reconcile as successful even though deployment failed, masking the real issue.Controller-runtime supports returning both
RequeueAfterand an error. The deployment error must be preserved so the failure is properly recorded.🔧 Proposed fix to preserve the deployment error
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{RequeueAfter: statusUpdateRequeueAfter}, nil + return reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, err } return reconcile.Result{}, errThis ensures:
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot combine reconcile.Result{RequeueAfter: statusUpdateRequeueAfter} with non-nil error. See controller-runtime code controller-runtime/pkg/internal/controller/controller.go line 467
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me look up the controller-runtime source code to verify this behavior.
@jmencak, you are absolutely correct, and I apologize for the incorrect suggestion.The controller-runtime documentation explicitly states: "If the returned error is non-nil, the
Resultis ignored and the request will be requeued using exponential backoff. The only exception is if the error is aTerminalErrorin which case no requeuing happens." And conversely, "If the error is nil and the returned Result has a non-zeroresult.RequeueAfter, the request will be requeued after the specified duration."The controller-runtime internal controller code confirms this — when both
RequeueAfter/Requeueare set and a non-nil error is returned, it logs: "Warning: Reconciler returned both a result with either RequeueAfter or Requeue set and a non-nil error. RequeueAfter and Requeue will always be ignored if the error is non-nil."So the PR's current pattern of
return reconcile.Result{RequeueAfter: statusUpdateRequeueAfter}, nilis the correct approach — thenilerror paired withRequeueAfterachieves the intended fixed-delay retry without triggering exponential backoff. My suggestion to return a non-nil error alongsideRequeueAfterwould have been silently ignored by the framework. The existing code in the PR is correct.