feat(exporter): add opt-in leader election to deduplicate collection across replicas#1051
Open
somaz94 wants to merge 1 commit into
Open
feat(exporter): add opt-in leader election to deduplicate collection across replicas#1051somaz94 wants to merge 1 commit into
somaz94 wants to merge 1 commit into
Conversation
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Jun 16, 2026
38be2d5 to
0875452
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in, lease-based leader election so running multiple replicas no longer multiplies load on the cloud provider pricing APIs. Off by default, so single-replica deployments are unchanged.
When enabled (
-leader-election.enabled):Lease./metricswith the base operational metrics plus acloudcost_exporter_leader_election_is_leadergauge, but do not call the provider APIs.The result is a single set of upstream API calls regardless of replica count. Sharding (splitting work across replicas) is intentionally out of scope, per the issue.
Validation
make lint— 0 issuesgo test ./...— all pass (newpkg/leaderelectiontests including a fake-clientset leadership-acquisition test; updatedcmd/exportertests for the split registry handler)make build-binary— successk8s.io/client-go,k8s.io/apimachinery,k8s.io/api@v0.34.2(stable)Docs
docs/deploying/leader-election.md— flags, required RBAC (leasesincoordination.k8s.io), and the leader gaugecloses: #1027