Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

rakesh-garimella
Copy link

@rakesh-garimella rakesh-garimella commented Jan 16, 2025

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 in onStoppedLeading, stops its operation, and waits to acquire the lease again.

The config would like this:

receivers:
  my_awesome_reciever:
    leader_elector: k8s_leader_elector
exporters:
  debug:
    verbosity: detailed
extensions:
  k8s_leader_elector:
    auth_type: kubeConfig
    lease_name: foo
    lease_namespace: default

service:
  extensions: [k8s_leader_elector]
  pipelines:
    metrics:
      receivers: [my_awesome_receiver]
      exporters: [debug]
  telemetry:
    logs:
      level: debug

Link to tracking issue

Fixes
#34460

Testing

unit tests have been added

Documentation

README file has been added

.github/CODEOWNERS Outdated Show resolved Hide resolved
.github/CODEOWNERS Outdated Show resolved Hide resolved
extension/leaderelector/metadata.yaml Outdated Show resolved Hide resolved
@rakesh-garimella rakesh-garimella changed the title [extension/leader elector] Initial implementation for the extension leader elector - basic structure [extension/k8s leader elector] Initial implementation for the extension leader elector - basic structure Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Component New component has been sponsored
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants