feat: in-memory join membership reverter#2309
Closed
louiseschmidtgen wants to merge 6 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an in-memory reverter mechanism to automatically clean up membership state if a node fails during the join process. The reverter ensures that failed join attempts don't leave orphaned entries in etcd or Kubernetes by registering cleanup functions that execute on join failure.
Changes:
- Introduces a reverter using the
github.com/canonical/lxd/shared/revertpackage to manage cleanup on join failure - Adds etcd membership cleanup for nodes joining with etcd datastore
- Adds Kubernetes Node object cleanup for nodes that fail after kubelet registration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bschimke95
reviewed
Jan 20, 2026
bschimke95
left a comment
Contributor
There was a problem hiding this comment.
Looks good so far. Could you add (or extend) a test-case to verify the reverter behavior for the etcd part?
Signed-off-by: Louise K. Schmidtgen <louise.schmidtgen@canonical.com>
6 tasks
Contributor
Author
|
Closed in favor of canonical/k8sd#6. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an in memory reverter for membership state.
If a node fails anywhere in the process membership get's reverted based on where we failed in the join process:
Limitation:
Clean-up of etcd is only desirable if we have less than 3 nodes in the cluster. If we were to remove 1 etcd node from a 2 node configuration we would loose quorum. Admins will need to manually need to clean-up the broken configuration.
Manual Testing
Inserted a fake error for the third joining node (see testing commit). After the third node artificially fails to join, I verified the memberships of microcluster, etcd, k8s to ensure the reverter works as expected.
Backport
1.32, 1.33, 1.34, 1.35
Checklist
type: title