Skip to content

Commit

Permalink
Merge pull request #229 from tkrop/patch-1
Browse files Browse the repository at this point in the history
Ensure pdb.minAvailable is always lower than choosen replicas
  • Loading branch information
ese authored Jan 28, 2020
2 parents 763147d + b33eb4f commit fc18d3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions operator/redisfailover/service/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ func (r *RedisFailoverKubeClient) ensurePodDisruptionBudget(rf *redisfailoverv1.
namespace := rf.Namespace

minAvailable := intstr.FromInt(2)
if rf.Spec.Redis.Replicas <= 2 {
minAvailable = intstr.FromInt(int(rf.Spec.Redis.Replicas - 1))
}

labels = util.MergeLabels(labels, generateSelectorLabels(component, rf.Name))

pdb := generatePodDisruptionBudget(name, namespace, labels, ownerRefs, minAvailable)
Expand Down

0 comments on commit fc18d3d

Please sign in to comment.