-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix operator startup delay caused by leader election lease not being released correctly #24978
Merged
michi-covalent
merged 1 commit into
cilium:main
from
giorio94:mio/operator-fix-release-lease
Apr 25, 2023
Merged
Fix operator startup delay caused by leader election lease not being released correctly #24978
michi-covalent
merged 1 commit into
cilium:main
from
giorio94:mio/operator-fix-release-lease
Apr 25, 2023
Conversation
This file contains 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
giorio94
added
kind/bug
This is a bug in the Cilium logic.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
area/operator
Impacts the cilium-operator component
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
labels
Apr 19, 2023
kubernetes-e2e hit #24622. Rerunning |
Travis CI hit unrelated flake #24491 |
/test |
The leader election logic of the operator is currently executed in a separate goroutine started by an OnStart hook, and relies on a context (canceled by the respective OnStop hook) for shutting down. Once this occurs, it will automatically release the lease, to allow the immediate election of a new leader. Yet, we do not explicitly wait for this operation to complete, and the operator might stop before the lease is actually released, introducing a ~15 seconds delay for the next election. This commit fixes this by introducing a WaitGroup to explicitly wait for the leader election loop to terminate before continuing with the shutdown process. Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
giorio94
force-pushed
the
mio/operator-fix-release-lease
branch
from
April 20, 2023 14:08
af4c97b
to
187bc7f
Compare
Rebased onto master since egressgw tests were failing due to #24835 having been merged. |
/test |
joamaki
approved these changes
Apr 24, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
maintainer-s-little-helper
bot
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Apr 24, 2023
thank you mlh |
sayboras
added
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
and removed
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
labels
Apr 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/operator
Impacts the cilium-operator component
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
kind/bug
This is a bug in the Cilium logic.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
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.
The leader election logic of the operator is currently executed in a separate goroutine started by an OnStart hook, and relies on a context (canceled by the respective OnStop hook) for shutting down. Once this occurs, it will automatically release the lease, to allow the immediate election of a new leader. Yet, we do not explicitly wait for this operation to complete, and the operator might stop before the lease is actually released, introducing a ~15 seconds delay for the next election.
This PR fixes this by introducing a WaitGroup to explicitly wait for the leader election loop to terminate before continuing with the shutdown process.