THREESCALE-14654 Fix status reconciler requeue logic - #1177
Conversation
|
/retest |
5c2e21f to
5086f39
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1177 +/- ##
==========================================
+ Coverage 44.03% 44.67% +0.63%
==========================================
Files 204 208 +4
Lines 20960 21235 +275
==========================================
+ Hits 9230 9487 +257
- Misses 10933 10948 +15
- Partials 797 800 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
5086f39 to
bf7312e
Compare
bf7312e to
9a9dee8
Compare
|
/retest |
1 similar comment
|
/retest |
| s.logger.V(1).Info("Status is different") | ||
| s.apimanagerResource.Status = *newStatus | ||
| if err := s.Client().Status().Update(s.Context(), s.apimanagerResource); err != nil { | ||
| return reconcile.Result{}, fmt.Errorf("failed to update status: %w", err) |
There was a problem hiding this comment.
We now ignore the Conflict error?
There was a problem hiding this comment.
I've restored the missing Conflict error check. I believe that code path is unreachable now (I mean in the current codebase, not after this change) that's why I removed it originally. It's better to leave it for consistency.
|
/retest |
9a9dee8 to
838603b
Compare
|
| Status | Scan Engine | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
…us write Two issues in the previous requeue logic: 1. The guard `equalStatus && newAvailable` caused the unavailable-but-equal case to fall through to a status write even when nothing had changed, producing a no-op write on every reconcile while the instance remained unavailable. The new `if equalStatus` guard short-circuits both the available and unavailable steady states, avoiding the unnecessary write. 2. Both unavailable return paths used `Requeue: true` (immediate requeue), which causes tight-loop reconciliation against an instance that is still unavailable. Switching to `RequeueAfter: 30s` gives components time to recover between checks and avoids extending backoff counter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
838603b to
e98339d
Compare
|
Reading the code again, I'm not sure what are we trying to solve here. If for whatever reason, we get into the unavailable-but-equal case, and if the ready status can't not be fixed and stay in unavailable state, with the current code, it will reconcile forever every 30s for no reason. Also if status is equal but the If the available state is updated, the status equality check will return false and trigger the status update process. |
Fixes https://issues.redhat.com/browse/THREESCALE-14654
Summary
equalStatus && newAvailableguard: the unavailable-but-equal case fell through to a no-op status write on every reconcile. Changed toif equalStatuswhich short-circuits both available and unavailable steady states.Requeue: true(immediate tight-loop) toRequeueAfter: 30s, giving components time to recover between checks and avoiding extending the backoff counter.Test plan
go test ./controllers/apps/... -run TestAPIManagerStatusReconcilerTestAPIManagerStatusReconciler_Reconcile_requeueAfterWhenUnavailableverifies RequeueAfter is non-zero on True→False transitionManual testing setup
Tested manually with following setup:
After system provisions and stabilises, delete one of the route, to induce "Available: false", observe the logs for some time - the reconcile was triggered every 30s.
🤖 Co-authored with Claude Code