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_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 ### Add cluster-specific labels
In some cases, you might want to add `labels` that are specific to a given 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. the template.
* **enable_pod_disruption_budget** * **enable_pod_disruption_budget**
if disabled `MinAvailable` in the PDB's spec will be set to `0`. That means PDB is enabled by default to protect the cluster from voluntarily disruptions
the PDB will get created anyway. The PDB is also relaxed when scaling down the and hence unwanted DB downtime. However, on some cloud providers it could be
Postgres cluster to `"numberOfInstances": 0`. By default PDB is enabled which necessary to temporarily disabled it, e.g. for node updates. See
results in `"MinAvailable": 1`. [admin docs](../administrator.md#pod-disruption-budget) for more information.
Default is true.
* **secret_name_template** * **secret_name_template**
a template for the name of the database user secrets generated by the a template for the name of the database user secrets generated by the

View File

@ -1268,26 +1268,26 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription)
result = append(result, v1.EnvVar{Name: "CLONE_WAL_BUCKET_SCOPE_PREFIX", Value: ""}) result = append(result, v1.EnvVar{Name: "CLONE_WAL_BUCKET_SCOPE_PREFIX", Value: ""})
if description.S3Endpoint != "" { if description.S3Endpoint != "" {
result = append(result, v1.EnvVar{Name: "CLONE_AWS_ENDPOINT", Value: description.S3Endpoint}) result = append(result, v1.EnvVar{Name: "CLONE_AWS_ENDPOINT", Value: description.S3Endpoint})
result = append(result, v1.EnvVar{Name: "CLONE_WALE_S3_ENDPOINT", Value: description.S3Endpoint}) result = append(result, v1.EnvVar{Name: "CLONE_WALE_S3_ENDPOINT", Value: description.S3Endpoint})
} }
if description.S3AccessKeyId != "" { if description.S3AccessKeyId != "" {
result = append(result, v1.EnvVar{Name: "CLONE_AWS_ACCESS_KEY_ID", Value: description.S3AccessKeyId}) result = append(result, v1.EnvVar{Name: "CLONE_AWS_ACCESS_KEY_ID", Value: description.S3AccessKeyId})
} }
if description.S3SecretAccessKey != "" { if description.S3SecretAccessKey != "" {
result = append(result, v1.EnvVar{Name: "CLONE_AWS_SECRET_ACCESS_KEY", Value: description.S3SecretAccessKey}) result = append(result, v1.EnvVar{Name: "CLONE_AWS_SECRET_ACCESS_KEY", Value: description.S3SecretAccessKey})
} }
if description.S3ForcePathStyle != nil { if description.S3ForcePathStyle != nil {
s3ForcePathStyle := "0" s3ForcePathStyle := "0"
if *description.S3ForcePathStyle { if *description.S3ForcePathStyle {
s3ForcePathStyle = "1" s3ForcePathStyle = "1"
} }
result = append(result, v1.EnvVar{Name: "CLONE_AWS_S3_FORCE_PATH_STYLE", Value: s3ForcePathStyle}) result = append(result, v1.EnvVar{Name: "CLONE_AWS_S3_FORCE_PATH_STYLE", Value: s3ForcePathStyle})
} }
} }
@ -1298,7 +1298,7 @@ func (c *Cluster) generatePodDisruptionBudget() *policybeta1.PodDisruptionBudget
minAvailable := intstr.FromInt(1) minAvailable := intstr.FromInt(1)
pdbEnabled := c.OpConfig.EnablePodDisruptionBudget 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 { if (pdbEnabled != nil && !*pdbEnabled) || c.Spec.NumberOfInstances <= 0 {
minAvailable = intstr.FromInt(0) minAvailable = intstr.FromInt(0)
} }