-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[receiver/k8sobjectsreceiver] k8sobject receiver support leader election #39054
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
base: main
Are you sure you want to change the base?
[receiver/k8sobjectsreceiver] k8sobject receiver support leader election #39054
Conversation
4bb004b
to
81d5190
Compare
81d5190
to
00284d7
Compare
}, | ||
func() { | ||
kr.setting.Logger.Info("Object Receiver stopped as leader lose") | ||
_ = kr.Shutdown(context.Background()) |
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.
you might like to log that error.
} | ||
|
||
kr.setting.Logger.Info("Trying to become the leader") | ||
elector := k8sLeaderElector.(k8sleaderelector.LeaderElection) |
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.
please check the casting to avoid panics.
Please resolve conflicts and add tests. It would be ideal to have a unit test that covers an election with receivers joining and leaving. |
Co-authored-by: Antoine Toulme <[email protected]>
1bed805
to
c7a8865
Compare
@atoulme A normal unit test can‘t achieve your suggestion. I will try to add a new e2e test to address this. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Hi @Frapschen have a look at this unit test may be it gives some inspiration: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/38429/files#diff-166c09ecb8e6d1da525f46005a9a3f6a8f5a4870b74f60a5e0e9a3adc7b97b60R96 ? |
Description
As #38426 move the k8sleaderelector from development to alpha, we can use it in k8sobjectsreceiver.