OCPMCP-538: relist ACM ManagedCluster watch on expired resourceVersion #580
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 254 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.332
Real PR Conversation Timeline
1 comments
"Review active on #580"
general
weight: 0.35
manusa
matzew
JIRA: https://issues.redhat.com/browse/OCPMCP-538
Problem
The ACM hub provider's
watchManagedClustersloop reconnected with the sameresourceVersionafter a watch closed. Once that RV aged out, the apiserver returns 410 Gone / Expired, which the loop ignored - the in-streamwatch.Errorevent (ametav1.Status) was dropped as "not Unstructured", and backoff only ran whenWatch()itself errored. Result: a tight reconnect loop flooding the apiserver/audit logs (~250 watch/sec in one lab), and deletions during the gap were never reflected.Fix
watch.Errorevent andWatch()returningResourceExpired/Gone. Both clear theresourceVersionso the next iteration relists and rewatches from a fresh list RV.refreshClustersreconciles against the authoritative list (prunes removed clusters), skips pruning on an empty/partial relist so a blip can't wipe all targets, and notifies only when the target set changed.Tests
reconcileClustersprune/no-op; watch loop relists + backs off for both the in-stream and direct 410 paths.Follow-up (out of scope)
Consider migrating this bespoke relist/backoff loop to client-go
tools/watch.RetryWatcheror an informer, which handle Expired detection, backoff, and bookmarks generically.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Cluster listings now add newly reported clusters and remove clusters that are no longer present. Empty listings no longer remove existing clusters.
Cluster updates recover more reliably after expired watch sessions by refreshing the cluster list before resuming updates.
* Repeated watch retries now use a cancellable delay that increases up to a five-minute limit, and resets after progress or sustained activity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->