Skip to content

feat: report unbalanced topology sharding in Reconciled condition#8670

Open
Sanchit2662 wants to merge 2 commits into
prometheus-operator:mainfrom
Sanchit2662:topology-sharding-unbalanced-condition
Open

feat: report unbalanced topology sharding in Reconciled condition#8670
Sanchit2662 wants to merge 2 commits into
prometheus-operator:mainfrom
Sanchit2662:topology-sharding-unbalanced-condition

Conversation

@Sanchit2662

@Sanchit2662 Sanchit2662 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

When topology sharding is enabled, the operator already blocks the severe case where shards is smaller than the number of zones (a zone would never get scraped). But the other edge case from the proposal, where shards isn't a multiple of the number of zones, was going through silently. In that case shard indices wrap around and some targets end up scraped by more than one shard, so you get duplicated samples with no hint that anything is off.

As discussed in the issue, this reports the situation on the Reconciled condition instead of failing the reconciliation. The status stays True with an UnbalancedTopologySharding reason and a message explaining it, so it doesn't block rollouts for people who set this up on purpose.

Wired for both Prometheus and PrometheusAgent, behind the existing PrometheusTopologySharding feature gate.

closes #8664

Type of change

  • FEATURE (non-breaking change which adds functionality)

Verification

Added a unit test (TestUnbalancedTopologyShardingMessage) covering address mode, exact multiples, shards == zones, non-multiples, nil shards and empty values. Happy to add an e2e asserting the condition on a live object if you'd prefer.

Changelog entry

Report unbalanced topology sharding (shards not a multiple of the number of zones) in the Reconciled status condition.

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
@Sanchit2662 Sanchit2662 requested a review from a team as a code owner July 3, 2026 13:28
Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zone-aware sharding doesn't warn when shards isn't a multiple of the number of zones

1 participant