Browse Source

add additional condition for sentinel pdb

tags/0.0.3
Vladimir Smagin 4 months ago
parent
commit
7a4a603f2b
2 changed files with 7 additions and 2 deletions
  1. +1
    -1
      README.md
  2. +6
    -1
      pkg/controller/redis/redis_controller.go

+ 1
- 1
README.md View File

@@ -73,7 +73,7 @@ spec:
minAvailable: 2
```

Note that `pdbSentinel.minAvailable` must be greater than `sentinelReplicas / 2` or reconcile fail. This made to save quorum.
Remember rule: `pdbSentinel.minAvailable > (sentinelReplicas / 2) > pdbSentinel.maxUnavailable`. This made to save quorum.

Open file `pkg/apis/blindage/v1alpha1/redis_types.go` to know more about options.



+ 6
- 1
pkg/controller/redis/redis_controller.go View File

@@ -206,11 +206,16 @@ fi
},
}
if instance.Spec.PdbSentinel.MaxUnavailable != nil {
// adorable if MaxUnavailable < (SentinelReplicas/2), just to save quorum
if *instance.Spec.PdbSentinel.MaxUnavailable > (*instance.Spec.SentinelReplicas / 2) {
reqLogger.Error(err, "Sentinel MaxUnavailable must be lesser then sentinelReplicas/2 to save quorum", "Namespace", instance.Namespace, "Name", instance.Name)
return reconcile.Result{}, err
}
pdbSpec.MaxUnavailable = &intstr.IntOrString{Type: intstr.Int, IntVal: *instance.Spec.PdbSentinel.MaxUnavailable}
}
if instance.Spec.PdbSentinel.MinAvailable != nil {
// adorable if MinAvailable > (SentinelReplicas/2), just to save quorum
if *instance.Spec.PdbSentinel.MinAvailable <= (*instance.Spec.SentinelReplicas / 2) {
if *instance.Spec.PdbSentinel.MinAvailable < (*instance.Spec.SentinelReplicas / 2) {
reqLogger.Error(err, "Sentinel MinAvailable must be greater then sentinelReplicas/2 to save quorum", "Namespace", instance.Namespace, "Name", instance.Name)
return reconcile.Result{}, err
}


Loading…
Cancel
Save