PSAP-2229: Prevent multiple reboots via MachineConfig creation/update sync #1474
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 471 lines diff across 5 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.368
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #1474"
general
weight: 0.35
jmencak
Problem
-------
When a PerformanceProfile is created or updated, two separate MachineConfigs are written by two independent controllers:
-
50-nto-written by the NTO operator controller-
50-performance-written by the PerformanceProfile controllerMCO batches MachineConfig renders with a 5-second renderDelay window. If the two writes do not land within that window, MCO renders them separately, causing two node reboots instead of just one.
Solution
--------
Replace racy in-memory bootcmdline cache with a Tuned CR generation-aware, synchronization protocol between the operator controller and the PerformanceProfile controller.
1. The operator controller stores a new dependency annotation
tuned.openshift.io/bootcmdline-depson each Profile CR in the format:<RELEASE_VERSION>,<tuned-name1>:<gen1>,...<tuned-nameN>:<genN>. The tuned-daemon controller (pkg/tuned/controller.go) then propagates this dependency to the Node as the sametuned.openshift.io/bootcmdline-depsannotation alongside the existingtuned.openshift.io/bootcmdlineannotation.2.
allNodesHaveCurrentBootcmdlineDeps(): eliminate the previous unreliable in-memory bootcmdline cache by checking every node in the pool has computed its bootcmdline from the same generation of Tuned CRs.3. Added cross-controller synchronization primitive
pkg/sync/bootcmdline.go:- The PerformanceProfile controller calls
IsReady(pool, "<performance-tuned-cr-name>:<gen>")before writing50-performance-. If not ready it returns BootcmdlineNotReadyError which requeues after 30s -- fallback mechanism -- shouldn't ever happen under normal circumstances.- The operator controller calls
SignalReady(pool, bootcmdlineDeps)via a deferred call immediately after a successful50-nto-MachineConfig create/update. The signal carries the full bootcmdlineDeps string so the PerformanceProfile controller can verify it is based on the current performance Tuned CR generation.SignalReady()also sends the pool name to a channel, to immediately wake up PerformanceProfile controller reconciliation.4. The PerformanceProfile controller now always creates/updates the Tuned CR first and returns early to wait for the bootcmdline-ready signal before writing its MachineConfig.
5. GetMutatedTuned now returns (Tuned, bool, error). The Tuned object is always returned (even when unchanged) so callers can read its .Generation field to construct the expected bootcmdline dependency string without an extra API call.
The same protocol is applied to the HyperShift handler, using the NodePool name as the pool key instead of the MCP name.
Unit tests are updated to reflect the new two-phase reconcile sequence (first reconcile creates/updates Tuned; second reconcile creates MachineConfig after
signalBootcmdlineReady()).<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Release Notes
New Features
Added bootcmdline dependency tracking and synchronization across cluster nodes to ensure consistent bootcmdline parameters.
Introduced bootcmdline readiness validation to coordinate resource creation and prevent incomplete deployments.
Extended HyperShift support for bootcmdline synchronization.
Improvements
Enhanced per-node bootcmdline status logging and conflict detection for better visibility into synchronization state.
Improved resource creation ordering for bootcmdline-dependent configurations.
Tests
Added bootcmdline synchronization tests with concurrent access scenarios.
* Updated existing test suite to validate new bootcmdline synchronization flows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->