Allow scale down stackgres statefulset preventing the disruption of primary
Following discussion at #78 (comment 223832053)
Currently, when using statefulset or other applications that manage a cluster of pods and allow to perform scale down, there is no way to prevent a particular pod from being disrupted. The topic is discussed in this kubernetes issue: https://github.com/kubernetes/kubernetes/issues/45509
A workaround (as explained in the note above) is to extract the pod from the statefulset by changing label disruptible
from true
to false
. This has to be done before updating the replicas number in the statefulset if the index number of the pod that has the label role
with value master
is equals or greater than the replicas number in the statefulset. The label disruptible
have to change from false
to true
whenever the index number of the pod that has the label role
with value master
is less than the replicas number in the statefulset.
The label must change before changing the replicas number in statefulset.