From 16b167b76c7bd9af525ce03ce6581433129e6896 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Mon, 17 Jun 2019 17:18:42 +0200 Subject: [PATCH] improve docs --- docs/administrator.md | 14 ++++++++++++++ docs/reference/operator_parameters.md | 9 +++++---- pkg/cluster/k8sres.go | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/docs/administrator.md b/docs/administrator.md index 4629d1284..caf82af63 100644 --- a/docs/administrator.md +++ b/docs/administrator.md @@ -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 diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 811011f82..e44a0f8cf 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -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 diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index cd025a687..81054ac93 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1268,26 +1268,26 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription) result = append(result, v1.EnvVar{Name: "CLONE_WAL_BUCKET_SCOPE_PREFIX", Value: ""}) if 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_AWS_ENDPOINT", Value: description.S3Endpoint}) + result = append(result, v1.EnvVar{Name: "CLONE_WALE_S3_ENDPOINT", Value: description.S3Endpoint}) } 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 != "" { - 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 { - s3ForcePathStyle := "0" + s3ForcePathStyle := "0" - if *description.S3ForcePathStyle { - s3ForcePathStyle = "1" - } + if *description.S3ForcePathStyle { + 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) 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) }