Skip to content

fix: leader election stop not called #2059

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

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void init(LeaderElectionConfiguration config) {
config.getRenewDeadline(),
config.getRetryPeriod(),
leaderCallbacks(),
true,
false, // this is required to receive stop event in all cases
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why, though?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean? we want to get those all cases

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that the comment doesn't explain why changing the value to false makes sure that stop is called…

Copy link
Collaborator Author

@csviri csviri Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be part of the fabric8 client docs rather, actually not there but it's in the go docs?
https://pkg.go.dev/k8s.io/client-go/tools/leaderelection#LeaderElectionConfig
Should I link this there you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe but mostly explain why this "release on cancel" setting has an impact on the lifecycle of our manager.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extended the comment, but basically this should be very straghforward, that the onStop is called, also if the lock is released.

config.getLeaseName()))
.build();
}
Expand Down