PodDisruptionBudget should be scoped per shard instead of per cluster
Problem
The operator currently creates a single PodDisruptionBudget for the entire ValkeyCluster with:
maxUnavailable: 1
- a selector matching only the cluster label (
valkey.io/cluster)
As a result, voluntary disruptions are limited across the entire cluster instead of being evaluated independently for each shard.
For example, with:
spec:
shards: 3
replicas: 2
the cluster consists of three independent shards:
Shard 0: Primary + Replica + Replica
Shard 1: Primary + Replica + Replica
Shard 2: Primary + Replica + Replica
A disruption affecting a pod in Shard 0 unnecessarily blocks a simultaneous disruption in Shard 2, even though the shards are independent failure domains.
Proposed solution
Instead of creating a single cluster-wide PodDisruptionBudget, create one PDB per shard.
Each PDB should select pods using both:
valkey.io/cluster
valkey.io/shard-index
For example:
selector:
matchLabels:
valkey.io/cluster: my-cluster
valkey.io/shard-index: "0"
This results in one PDB for each shard.
PDB policy
I suggest using:
for each shard.
The purpose of the PDB is to ensure that at least one node of each shard remains available during voluntary disruptions while allowing maintenance to proceed independently across different shards.
Benefits
- PDBs align with the shard-based architecture of Valkey Cluster.
- Independent shards no longer block each other's maintenance.
- Node drains and rolling updates can progress concurrently on different shards.
- Availability guarantees become scoped to the actual failure domain (the shard) instead of the entire cluster.
I'd be happy to contribute a PR implementing this change if the maintainers agree with the approach.
PodDisruptionBudget should be scoped per shard instead of per cluster
Problem
The operator currently creates a single
PodDisruptionBudgetfor the entireValkeyClusterwith:maxUnavailable: 1valkey.io/cluster)As a result, voluntary disruptions are limited across the entire cluster instead of being evaluated independently for each shard.
For example, with:
the cluster consists of three independent shards:
A disruption affecting a pod in Shard 0 unnecessarily blocks a simultaneous disruption in Shard 2, even though the shards are independent failure domains.
Proposed solution
Instead of creating a single cluster-wide
PodDisruptionBudget, create one PDB per shard.Each PDB should select pods using both:
valkey.io/clustervalkey.io/shard-indexFor example:
This results in one PDB for each shard.
PDB policy
I suggest using:
for each shard.
The purpose of the PDB is to ensure that at least one node of each shard remains available during voluntary disruptions while allowing maintenance to proceed independently across different shards.
Benefits
I'd be happy to contribute a PR implementing this change if the maintainers agree with the approach.