Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add leader election#442

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@mikesmithgh
Copy link
Collaborator

@mikesmithghmikesmithgh commentedFeb 13, 2022
edited
Loading

I would like to add leader election. Due to node autoscaler and other variables in the cluster, the metacontroller pod can get rolled/shifted to other nodes. Typically, this does not cause any problems and metacontroller comes up fast. However, we occasionally have issues with inconsistency between environment and bad nodes which may cause metacontroller to be stuck in a pending state for a while. This would allow for more coverage and reduce the chance of downtime in this scenario.

AmitKumarDas reacted with heart emoji
@codecov
Copy link

codecovbot commentedFeb 13, 2022
edited
Loading

Codecov Report

Merging#442 (2d9198f) intomaster (3b690b2) willdecrease coverage by0.05%.
The diff coverage is37.50%.

❗ Current head2d9198f differs from pull request most recent head95b3337. Consider uploading reports for the commit95b3337 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@##           master     #442      +/-   ##==========================================- Coverage   49.33%   49.27%   -0.06%==========================================  Files          56       56                Lines        4966     4980      +14     ==========================================+ Hits         2450     2454       +4- Misses       2265     2275      +10  Partials      251      251
FlagCoverage Δ
integration43.22% <100.00%> (+0.15%)⬆️
unit28.31% <0.00%> (-0.08%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
main.go0.00% <0.00%> (ø)
pkg/server/server.go58.57% <100.00%> (+2.51%)⬆️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update3b690b2...95b3337. Read thecomment docs.

@mikesmithgh
Copy link
CollaboratorAuthor

HI@grzesuav and@AmitKumarDas, could you please review when you have free time? I left this in draft because I have TODOs around naming and will update after feedback.

AmitKumarDas reacted with thumbs up emoji

@grzesuav
Copy link
Contributor

hi @mjsmith1028 , it would be good to have consistency withhttps://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/leaderelection/leader_election.go.

About cmd line options, I would make them the same as config options (i.e.leaderElectionEnabled, etc). I didn't went trough leader election in ctrl-runtime so cannot give more precise advice at the moment. I am aware that multiple resources can be used as leader key object, please make sure to use newest ones (I remember that ctrl-runtime is going away from configmaps to another resources)

Thanks for PR!

@AmitKumarDas
Copy link
Contributor

AmitKumarDas commentedFeb 16, 2022
edited
Loading

@mjsmith1028 Did you run some tests to verify if nothing breaks. Is it feasible for you to add some tests / examples that can verify this behaviour?
@grzesuav Is metacontroller now making use of controller-runtime such that just exposing the latter's arguments enable metacontroller to achieve what controller-runtime is capable of?

@mikesmithgh
Copy link
CollaboratorAuthor

hi @mjsmith1028 , it would be good to have consistency withhttps://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/leaderelection/leader_election.go.

About cmd line options, I would make them the same as config options (i.e.leaderElectionEnabled, etc). I didn't went trough leader election in ctrl-runtime so cannot give more precise advice at the moment. I am aware that multiple resources can be used as leader key object, please make sure to use newest ones (I remember that ctrl-runtime is going away from configmaps to another resources)

Thanks for PR!

@grzesuav Thanks! I updated to expose all the leader election options and defaulted to the preferred resource lock leases. I'll add some documentation around this. I am wondering if there is any concern about the growing number of arguments passed to metacontroller or if you are fine with that approach?

@mikesmithgh
Copy link
CollaboratorAuthor

@mjsmith1028 Did you run some tests to verify if nothing breaks. Is it feasible for you to add some tests / examples that can verify this behaviour?@grzesuav Is metacontroller now making use of controller-runtime such that just exposing the latter's arguments enable metacontroller to achieve what controller-runtime is capable of?

@AmitKumarDas I only ran some small manual testing around this to verify a leader was elected and the other replica waits until the leader is in a bad state before becoming the new leader. I can definitely add an example. I'm not 100% sure on the approach I should take for testing but I'll think on it. Do you have any ideas?

@mikesmithghmikesmithghforce-pushed theleader-election branch 2 times, most recently fromea80314 tob2019f0CompareMarch 4, 2022 04:42
@mikesmithghmikesmithgh marked this pull request as ready for reviewMarch 4, 2022 04:56
@mikesmithgh
Copy link
CollaboratorAuthor

Hi@AmitKumarDas and@grzesuav, I cleaned up this PR and it is ready to review. Please let me know if you have anymore feedback.

@mikesmithghmikesmithghforce-pushed theleader-election branch 2 times, most recently from2d9198f to481f378CompareMarch 7, 2022 19:41
@mikesmithgh
Copy link
CollaboratorAuthor

FYI I rebased to clean up the commit history.

Signed-off-by: Mike Smith <10135646+mjsmith1028@users.noreply.github.com>
Copy link
Contributor

@grzesuavgrzesuav left a comment

Choose a reason for hiding this comment

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

Looks good and clear, thanks for this PR !

mikesmithgh reacted with thumbs up emoji
@grzesuavgrzesuav merged commit29563b2 intometacontroller:masterMar 8, 2022
@grzesuav
Copy link
Contributor

🎉 This PR is included in version 2.3.0 🎉

The release is available onGitHub release

Yoursemantic-release bot 📦🚀

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@AmitKumarDasAmitKumarDasAmitKumarDas approved these changes

@grzesuavgrzesuavgrzesuav approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@mikesmithgh@grzesuav@AmitKumarDas

[8]ページ先頭

©2009-2025 Movatter.jp