[WIP] OCPBUGS-105240: fix bootstrap race by gating TNF on EtcdBootstrapMemberRemoved - #1672
[WIP] OCPBUGS-105240: fix bootstrap race by gating TNF on EtcdBootstrapMemberRemoved#1672Neilhamza wants to merge 2 commits into
Conversation
…erRemoved The TNF bootstrap gate (done() in waitforceo.go) previously checked only EtcdRunningInCluster to decide when bootstrap was complete. However, removeBootstrap() sets EtcdRunningInCluster=True before calling MemberRemove(), creating a race window where pacemaker can start while the etcd-bootstrap member still exists. When the podman-etcd resource agent sees 3 members instead of 2, it refuses to set the learner_node attribute, deadlocking master-1's etcd startup. Add EtcdBootstrapMemberRemoved as an additional gate condition. This condition is set after MemberRemove() succeeds, ensuring the bootstrap member is actually gone before TNF setup proceeds. Both conditions are required (AND) as a defensive invariant since their ordering is not consistent across removeBootstrap() code paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@Neilhamza: This pull request references Jira Issue OCPBUGS-105240, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe etcd bootstrap completion check now requires both ChangesEtcd bootstrap completion
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/operator/bootstrapteardown/waitforceo_test.go`:
- Around line 38-44: Add table-driven cases in the existing wait-force condition
test alongside “EtcdRunningInCluster true but EtcdBootstrapMemberRemoved false”
for EtcdRunningInCluster=false with EtcdBootstrapMemberRemoved=true and false,
covering both missing-completion outcomes while preserving the expected results
defined by the test’s behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 2f21c59c-bdaf-4902-b41c-ddb70538f721
📒 Files selected for processing (2)
pkg/operator/bootstrapteardown/waitforceo.gopkg/operator/bootstrapteardown/waitforceo_test.go
Add explicit false-state coverage for both conditions: - EtcdRunningInCluster=false with EtcdBootstrapMemberRemoved=true - Both conditions explicitly false This completes the full boolean matrix for the AND gate logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@Neilhamza: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Fix a race condition in the TNF bootstrap gate that can deadlock cluster installation ~10% of the time.
The
done()function inwaitforceo.gopreviously checked onlyEtcdRunningInClusterto decide when bootstrap was complete. However,removeBootstrap()in the bootstrap teardown controller setsEtcdRunningInCluster=Truebefore callingMemberRemove(), creating a race window where pacemaker can start while theetcd-bootstrapmember still exists. When thepodman-etcdresource agent sees 3 etcd members instead of the expected 2, it refuses to set thelearner_nodeattribute, deadlocking master-1's etcd startup indefinitely.Changes
EtcdBootstrapMemberRemovedas an additional gate condition indone()(AND withEtcdRunningInCluster)EtcdBootstrapMemberRemovedis set afterMemberRemove()succeeds, ensuring the bootstrap member is actually gone before TNF setup proceedsdone()function covering all condition combinationsWhy AND rather than EtcdBootstrapMemberRemoved alone
The ordering of the two conditions is not consistent across
removeBootstrap()code paths (Path 1 sets removed-first, Path 3 sets running-first). Requiring both is a defensive invariant: "etcd is running in-cluster AND the bootstrap member is confirmed gone."Scope
This fix targets the initial-install path only. Post-transition (
HasExternalEtcdCompletedTransition()is true), the gate is skipped entirely on CEO restarts — that path is unaffected.Latency caveat
setSuccessfulBootstrapRemovalStatus()can fail afterMemberRemove()succeeds (raft settling). In that case,EtcdBootstrapMemberRemovedis set on the next controller sync (~1 min). Net effect: TNF setup may start up to one sync cycle later than today. No functional impact — the member is already gone.Bug
https://issues.redhat.com/browse/OCPBUGS-105240
Test plan
done()covering all condition combinations (5 cases)TestRemoveBootstrapandTestCanRemoveEtcdBootstraptests passtime.Sleepbetween Step 1 and Step 3 inremoveBootstrap()) to confirm deadlock, then verify this fix blocks TNF setup until member is actually removedSummary by CodeRabbit
Bug Fixes
Tests