-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[extension/k8s leader elector] Initial implementation for the extension leader elector - basic structure #37266
[extension/k8s leader elector] Initial implementation for the extension leader elector - basic structure #37266
Conversation
return nil, errors.New("failed to create k8s client") | ||
} | ||
|
||
leaseHolderID, err := os.Hostname() |
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.
Can we always rely on this to be unique within the cluster? Probably not. I think this should be a configurable option with this value as a default.
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (53.84%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #37266 +/- ##
==========================================
+ Coverage 79.60% 79.65% +0.05%
==========================================
Files 2308 2315 +7
Lines 216392 217241 +849
==========================================
+ Hits 172253 173051 +798
- Misses 38381 38414 +33
- Partials 5758 5776 +18 ☔ View full report in Codecov by Sentry. |
…on (#38015) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Added the actual implementation for leader election Initial structure was added here: [basic structure](#37266) <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #34460 <!--Describe what testing was performed and which tests were added.--> #### Testing unit tests added <!--Describe the documentation added.--> #### Documentation documentation is provided <!--Please delete paragraphs that you did not use before submitting.-->
…elog (#38426) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description - Change the stability level to alpha and allow print it in the change log. - Also adjust the documentation PR for [Implementation](#38015) Pr for [Basic structure](#37266) <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #34460 <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation provided <!--Please delete paragraphs that you did not use before submitting.-->
Description
This extension could be used to run multiple receivers in HA mode. The receiver which has successfully acquired the lease becomes active and thus becomes leader.
The extension uses k8s.io/client-go/tools/leaderelection to perform leader election. The component that owns the lease becomes the leader and runs the function defined in
onStartedLeading
. If the leader loses the lease, it runs the function defined inonStoppedLeading
, stops its operation, and waits to acquire the lease again.The config would like this:
Link to tracking issue
Fixes
#34460
Testing
unit tests have been added
Documentation
README file has been added