improve docs

This commit is contained in:
Felix Kunde 2019-06-17 17:18:42 +02:00
parent 8285a3b7b7
commit 16b167b76c
3 changed files with 29 additions and 14 deletions

View File

@ -154,6 +154,20 @@ data:
pod_antiaffinity_topology_key: "failure-domain.beta.kubernetes.io/zone"
```
### Pod Disruption Budget
By default the operator uses a PodDisruptionBudget (PDB) to protect the cluster
from voluntarily disruptions and hence unwanted DB downtime. The `MinAvailable`
parameter of the PDB is set to `1` which makes it work for single-node clusters
or in situations when there is no master (e.g. standby clusters).
The PDB is only relaxed in two scenarios:
* If a cluster is scaled down to `0` instances (e.g. for draining nodes)
* If the PDB is disabled in the configuration (`enable_pod_disruption_budget`)
The PDB is still in place having `MinAvailable` set to `0`. If enabled it will
be automatically set to `1` on scale up.
### Add cluster-specific labels
In some cases, you might want to add `labels` that are specific to a given

View File

@ -162,10 +162,11 @@ configuration they are grouped under the `kubernetes` key.
the template.
* **enable_pod_disruption_budget**
if disabled `MinAvailable` in the PDB's spec will be set to `0`. That means
the PDB will get created anyway. The PDB is also relaxed when scaling down the
Postgres cluster to `"numberOfInstances": 0`. By default PDB is enabled which
results in `"MinAvailable": 1`.
PDB is enabled by default to protect the cluster from voluntarily disruptions
and hence unwanted DB downtime. However, on some cloud providers it could be
necessary to temporarily disabled it, e.g. for node updates. See
[admin docs](../administrator.md#pod-disruption-budget) for more information.
Default is true.
* **secret_name_template**
a template for the name of the database user secrets generated by the

View File

@ -1298,7 +1298,7 @@ func (c *Cluster) generatePodDisruptionBudget() *policybeta1.PodDisruptionBudget
minAvailable := intstr.FromInt(1)
pdbEnabled := c.OpConfig.EnablePodDisruptionBudget
// Is PodDisruptionBudget is disabled or if there is no master, set the budget to 0.
// if PodDisruptionBudget is disabled or if there are no DB pods, set the budget to 0.
if (pdbEnabled != nil && !*pdbEnabled) || c.Spec.NumberOfInstances <= 0 {
minAvailable = intstr.FromInt(0)
}