Release init-lock when the owner machine fails to launch #41
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.
Issue #, if available:
https://github.com/aws/eks-anywhere-internal/issues/2715
Description of changes:
During the init process, etcdadm-bootstrap uses a init-lock for synchronization to ensure only the first machine runs the init command. If for some reason, the first machine that gets created is unable to launch we end up with a deadlock, as all other machines wait on the owning machine to release the lock. Check if the machine owning the lock exists, and release the lock if the machine isn't not found to prevent the deadlock situation.
Before:
2024-10-16T03:01:50Z INFO etcd-init-locker Waiting on another machine to initialize {"namespace": "eksa-system", "cluster-name": "rxc-cse-nifi-w1", "configmap-name": "rxc-cse-nifi-w1-etcd-lock", "machine-name": "rxc-cse-nifi-w1-etcd-9m4vv", "init-machine": "rxc-cse-nifi-w1-etcd-fwrmc”}
After:
2024-10-29T00:35:57Z INFO etcd-init-locker Machine that has acquired the lock not found, releasing the lock {"namespace": "eksa-system", "cluster-name": "rahul-mgmt-cs", "configmap-name": "rahul-mgmt-cs-etcd-lock", "machine-name": "rahul-mgmt-cs-etcd-cqrtw", "init-machine": "rahul-mgmt-cs-etcd-bxmp7"}
Testing:
Tested with a custom build and bundles override and deleted the first etcd machine that launched. The bootstrap controller was able to reconcile successfully.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.