From 611e48c51ecc72fa1f08337c7eaf927fa30976fe Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 20 Apr 2023 14:28:24 +0200 Subject: [PATCH] rename failsafe_mode option in opconfig CRD (#2298) --- .../crds/operatorconfigurations.yaml | 2 +- charts/postgres-operator/templates/configmap.yaml | 1 + .../templates/operatorconfiguration.yaml | 2 ++ charts/postgres-operator/values.yaml | 2 +- docs/reference/cluster_manifest.md | 9 ++++++--- docs/reference/operator_parameters.md | 13 +++++++++++++ manifests/configmap.yaml | 2 +- manifests/operatorconfiguration.crd.yaml | 2 +- .../postgresql-operator-default-configuration.yaml | 4 ++-- pkg/apis/acid.zalan.do/v1/crds.go | 2 +- .../acid.zalan.do/v1/operator_configuration_type.go | 2 +- 11 files changed, 30 insertions(+), 11 deletions(-) diff --git a/charts/postgres-operator/crds/operatorconfigurations.yaml b/charts/postgres-operator/crds/operatorconfigurations.yaml index 20fcee21b..d523e3b17 100644 --- a/charts/postgres-operator/crds/operatorconfigurations.yaml +++ b/charts/postgres-operator/crds/operatorconfigurations.yaml @@ -670,7 +670,7 @@ spec: patroni: type: object properties: - failsafe_mode: + enable_patroni_failsafe_mode: type: boolean default: false status: diff --git a/charts/postgres-operator/templates/configmap.yaml b/charts/postgres-operator/templates/configmap.yaml index 094652a21..471f1aee4 100644 --- a/charts/postgres-operator/templates/configmap.yaml +++ b/charts/postgres-operator/templates/configmap.yaml @@ -26,4 +26,5 @@ data: {{- include "flattenValuesForConfigMap" .Values.configLoggingRestApi | indent 2 }} {{- include "flattenValuesForConfigMap" .Values.configTeamsApi | indent 2 }} {{- include "flattenValuesForConfigMap" .Values.configConnectionPooler | indent 2 }} +{{- include "flattenValuesForConfigMap" .Values.configPatroni | indent 2 }} {{- end }} diff --git a/charts/postgres-operator/templates/operatorconfiguration.yaml b/charts/postgres-operator/templates/operatorconfiguration.yaml index ef4674d94..6d3b0eb83 100644 --- a/charts/postgres-operator/templates/operatorconfiguration.yaml +++ b/charts/postgres-operator/templates/operatorconfiguration.yaml @@ -40,4 +40,6 @@ configuration: {{ toYaml .Values.configLoggingRestApi | indent 4 }} connection_pooler: {{ toYaml .Values.configConnectionPooler | indent 4 }} + patroni: +{{ toYaml .Values.configPatroni | indent 4 }} {{- end }} diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index aa17bcc68..f6b6b2491 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -431,7 +431,7 @@ configConnectionPooler: configPatroni: # enable Patroni DCS failsafe_mode feature - failsafe_mode: false + enable_patroni_failsafe_mode: false # Zalando's internal CDC stream feature enableStreams: false diff --git a/docs/reference/cluster_manifest.md b/docs/reference/cluster_manifest.md index 60343dd4f..8caf55b94 100644 --- a/docs/reference/cluster_manifest.md +++ b/docs/reference/cluster_manifest.md @@ -334,9 +334,12 @@ explanation of `ttl` and `loop_wait` parameters. Patroni `synchronous_node_count` parameter value. Note, this option is only available for Spilo images with Patroni 2.0+. The default is set to `1`. Optional. * **failsafe_mode** - Patroni `failsafe_mode` parameter value. If enabled, allows Patroni to cope with DCS outages and avoid leader demotion. See the Patroni documentation - [here](https://patroni.readthedocs.io/en/master/dcs_failsafe_mode.html) for more details. This feature is included since Patroni 3.0.0. - Hence, check the container image in use if this feature is included in the used Patroni version. The default is set to `false`. Optional. + Patroni `failsafe_mode` parameter value. If enabled, Patroni will cope + with DCS outages by avoiding leader demotion. See the Patroni documentation + [here](https://patroni.readthedocs.io/en/master/dcs_failsafe_mode.html) for more details. + This feature is included since Patroni 3.0.0. Hence, check the container + image in use if this feature is included in the used Patroni version. The + default is set to `false`. Optional. ## Postgres container resources diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 198870d77..29d66aee9 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -549,6 +549,19 @@ CRD-based configuration. hard memory minimum what we consider to be required to properly run Postgres clusters with Patroni on Kubernetes. The default is `250Mi`. +## Patroni options + +Parameters configuring Patroni. In the CRD-based configuration they are grouped +under the `patroni` key. + +* **enable_patroni_failsafe_mode** + If enabled, Patroni copes with DCS outages by avoiding leader demotion. + See the Patroni documentation [here](https://patroni.readthedocs.io/en/master/dcs_failsafe_mode.html) for more details. + This feature is included since Patroni 3.0.0. Hence, check the container image + in use if this feature is included in the used Patroni version. It can also be + enabled cluster-wise with the `failsafe_mode` flag under the `patroni` section + in the manifest. The default for the global config option is set to `false`. + ## Operator timeouts This set of parameters define various timeouts related to some operator diff --git a/manifests/configmap.yaml b/manifests/configmap.yaml index af9dd8acf..73f2f00ed 100644 --- a/manifests/configmap.yaml +++ b/manifests/configmap.yaml @@ -47,7 +47,7 @@ data: enable_master_load_balancer: "false" enable_master_pooler_load_balancer: "false" enable_password_rotation: "false" - # enable_patroni_failsafe_mode: "false" + enable_patroni_failsafe_mode: "false" enable_pgversion_env_var: "true" # enable_pod_antiaffinity: "false" # enable_pod_disruption_budget: "true" diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index 6b917a31c..f5778a199 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -668,7 +668,7 @@ spec: patroni: type: object properties: - failsafe_mode: + enable_patroni_failsafe_mode: type: boolean default: false status: diff --git a/manifests/postgresql-operator-default-configuration.yaml b/manifests/postgresql-operator-default-configuration.yaml index bff5a634e..82e56516d 100644 --- a/manifests/postgresql-operator-default-configuration.yaml +++ b/manifests/postgresql-operator-default-configuration.yaml @@ -209,5 +209,5 @@ configuration: connection_pooler_number_of_instances: 2 # connection_pooler_schema: "pooler" # connection_pooler_user: "pooler" - # patroni: - # failsafe_mode: "false" + patroni: + enable_patroni_failsafe_mode: false diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index b82aa30b6..558a03f0f 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -1483,7 +1483,7 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{ "patroni": { Type: "object", Properties: map[string]apiextv1.JSONSchemaProps{ - "failsafe_mode": { + "enable_patroni_failsafe_mode": { Type: "boolean", }, }, diff --git a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go index 4ff5ee81e..d966aa1aa 100644 --- a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go +++ b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go @@ -240,7 +240,7 @@ type OperatorLogicalBackupConfiguration struct { // PatroniConfiguration defines configuration for Patroni type PatroniConfiguration struct { - FailsafeMode *bool `json:"failsafe_mode,omitempty"` + FailsafeMode *bool `json:"enable_patroni_failsafe_mode,omitempty"` } // OperatorConfigurationData defines the operation config