MULTIARCH-6271: OLM CSV lifecycle cycling prevents operator convergence and blocks CPPC finalizer processing #522
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.47) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 497 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.372
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #522"
general
weight: 0.35
jcpowermac
Summary
Fixes a reconciliation storm (MULTIARCH-6271) where the operator enters a tight loop after OLM bundle install, preventing convergence and blocking CPPC finalizer processing. The root cause was three interacting feedback loops:
- Service always-update: applyService issued an unconditional Update() on every reconcile because server-defaulted fields (clusterIP, sessionAffinity, ipFamilies) never matched the required spec. This triggered Owns() watch events, feeding the loop. Observed: 472 Service updates in 27 minutes.
- Deploy/DaemonSet expectedGeneration=0: Passing 0 to library-go's ApplyDeployment/ApplyDaemonSet disables the spec-hash skip path entirely, causing an Update on every reconcile even when nothing changed.
- Sub-millisecond requeue on progressing: updateStatus returned a plain error when progressing, which goes through controller-runtime's exponential backoff starting at 1ms — effectively an immediate requeue. Combined with status updates re-triggering the unfiltered For() watch, this created a near-continuous reconciliation loop.
Changes
- Diff-aware applyService (pkg/utils/resource.go): Compare only operator-managed fields (ports, selector, type) against existing state. Skip the Update when nothing changed. Handles server-defaulted Type (empty → ClusterIP) and Protocol (empty → TCP).
- Generation-tracked applyDeployment/applyDaemonSet (pkg/utils/resource.go): Wrap library-go's apply functions with in-memory generation tracking using operatorv1.GenerationStatus and resourcemerge helpers — the standard OpenShift pattern. On first reconcile (or pod restart), ExpectedDeploymentGeneration returns -1, so the first apply always runs. After that, updates are skipped when the generation matches.
- 5s requeue when progressing (clusterpodplacementconfig_controller.go): Replace plain error return with requeueAfterError(5time.Second, ...), which uses ctrl.Result{RequeueAfter: 5s} and calls queue.Forget() to reset the rate limiter.
- Filter Owns() watch events (clusterpodplacementconfig_controller.go): Add GenerationChangedPredicate to MutatingWebhookConfiguration, ServiceMonitor, and PrometheusRule Owns() watches. Intentionally left off Deployment/DaemonSet (status-only changes like crashes don't bump generation) and RBAC resources (generation never increments).
- Filter status-only updates on primary CPPC watch (clusterpodplacementconfig_controller.go): Custom predicate on For() that passes generation changes, deletionTimestamp changes, and finalizer changes, but filters pure status updates. This prevents r.Status().Update() from immediately re-triggering reconciliation and nullifying the 5s requeue.
- CSV stabilization wait (hack/deploy-and-e2e.sh): Poll for CSV existence (with RBAC/API error distinction and per-request timeout), wait for Succeeded phase, and add 10s stabilization sleep before running e2e tests in OLM
deployments.
- Unit tests (pkg/utils/resource_test.go): 20 test cases covering Service comparison (13 cases), Deployment skip/detect (2), DaemonSet skip (1), Service apply skip/detect (2), generation isolation (1), and a helper.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Bug Fixes
Improved deployment reliability by waiting for operators to become ready before end-to-end validation.
Reduced unnecessary resource updates and reconciliations, improving application stability.
Improved retry handling for configurations that are still progressing.
Prevented unrelated configuration changes from triggering unnecessary reconciliations.
Preserved server-provided service defaults and applied updates only when required.
Added graceful handling for delayed or unavailable operator readiness during deployment validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->