Skip to content

feat(logstorage): validate replicas < node count to prevent ILM stall#4529

Open
tianfeng92 wants to merge 3 commits intotigera:masterfrom
tianfeng92:fix/logstorage-validate-replicas-node-count-master
Open

feat(logstorage): validate replicas < node count to prevent ILM stall#4529
tianfeng92 wants to merge 3 commits intotigera:masterfrom
tianfeng92:fix/logstorage-validate-replicas-node-count-master

Conversation

@tianfeng92
Copy link
Contributor

@tianfeng92 tianfeng92 commented Mar 11, 2026

Description

On single-node ES clusters with replicas: 1, replica shards can never be allocated. This causes the ILM warm phase migrate action to wait indefinitely for shard copies to become active, blocking progression to the delete phase and causing indices to accumulate beyond retention.

This PR adds two levels of validation in the LogStorage initializer:

  1. Error (nodeCount <= replicas): Rejects configurations where replica shards cannot be allocated at all, with a clear error message guiding users to set replicas to 0 for single-node deployments.
  2. Warning (nodeCount == replicas + 1): Logs a warning when the node count only exceeds replicas by 1, since the Elasticsearch PodDisruptionBudget will prevent voluntary pod evictions (e.g., node repaving). This is not treated as an error because it is a valid and common configuration (e.g., Calico Cloud 2-node clusters with 1 replica).

For CE master
Jira ticket: CI-1940

Release Note

Add validation for logstorage node count and replicas setting.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@marvin-tigera marvin-tigera added this to the v1.42.0 milestone Mar 11, 2026
@tianfeng92 tianfeng92 marked this pull request as ready for review March 11, 2026 21:50
@tianfeng92 tianfeng92 requested a review from a team as a code owner March 11, 2026 21:50
@tianfeng92 tianfeng92 changed the title fix(logstorage): validate replicas < node count to prevent ILM stall feat(logstorage): validate replicas < node count to prevent ILM stall Mar 11, 2026
@tianfeng92 tianfeng92 force-pushed the fix/logstorage-validate-replicas-node-count-master branch from 765effe to 0e6fd84 Compare March 13, 2026 17:32
On single-node ES clusters with replicas: 1, replica shards can never
be allocated. This causes the ILM warm phase migrate action to wait
indefinitely for shard copies to become active, blocking progression
to the delete phase and causing indices to accumulate beyond retention.

Add validation in the LogStorage initializer that rejects configurations
where indices.replicas >= nodes.count, with a clear error message
guiding users to set replicas to 0 for single-node deployments.
@tianfeng92 tianfeng92 force-pushed the fix/logstorage-validate-replicas-node-count-master branch from 0e6fd84 to cc42c9a Compare March 13, 2026 17:34
@tianfeng92 tianfeng92 requested review from rene-dekker and tmjd March 13, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants