From 1ca8028fa5146d16f22652674bbb1e7f006ea98d Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 20 Mar 2020 11:31:49 +0100 Subject: [PATCH] use min instances 2 everywhere and update reference docs --- .../crds/operatorconfigurations.yaml | 3 ++- charts/postgres-operator/crds/postgresqls.yaml | 2 +- charts/postgres-operator/values.yaml | 2 +- docs/reference/operator_parameters.md | 14 +++++++++----- manifests/configmap.yaml | 2 +- manifests/operatorconfiguration.crd.yaml | 3 ++- manifests/postgresql.crd.yaml | 2 +- pkg/apis/acid.zalan.do/v1/crds.go | 7 ++++--- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/charts/postgres-operator/crds/operatorconfigurations.yaml b/charts/postgres-operator/crds/operatorconfigurations.yaml index a45607905..f34e2957f 100644 --- a/charts/postgres-operator/crds/operatorconfigurations.yaml +++ b/charts/postgres-operator/crds/operatorconfigurations.yaml @@ -341,7 +341,8 @@ spec: #default: "transaction" connection_pool_number_of_instances: type: integer - #default: 1 + minimum: 2 + #default: 2 connection_pool_default_cpu_limit: type: string pattern: '^(\d+m|\d+(\.\d{1,3})?)$' diff --git a/charts/postgres-operator/crds/postgresqls.yaml b/charts/postgres-operator/crds/postgresqls.yaml index d8cfb1556..a4c0e4f3a 100644 --- a/charts/postgres-operator/crds/postgresqls.yaml +++ b/charts/postgres-operator/crds/postgresqls.yaml @@ -120,7 +120,7 @@ spec: - "transaction" numberOfInstances: type: integer - minimum: 1 + minimum: 2 resources: type: object required: diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index 06f1fd322..55c9daa6a 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -258,7 +258,7 @@ configConnectionPool: # default pooling mode connection_pool_mode: "transaction" # number of pooler instances - connection_pool_number_of_instances: 1 + connection_pool_number_of_instances: 2 # default resources connection_pool_default_cpu_request: "1" connection_pool_default_memory_request: "100Mi" diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 507f9ad1e..0309d6b68 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -604,25 +604,29 @@ but do not specify some of the parameters. All of them are optional with the operator being able to provide some reasonable defaults. * **connection_pool_number_of_instances** - How many instances of connection pool to create. + How many instances of connection pool to create. Default is 2 which is also + the required minimum. * **connection_pool_schema** - Schema to create for credentials lookup function. + Schema to create for credentials lookup function. Default is `pooler`. * **connection_pool_user** User to create for connection pool to be able to connect to a database. + Default is `pooler`. * **connection_pool_image** Docker image to use for connection pool deployment. + Default: "registry.opensource.zalan.do/acid/pgbouncer:master-5" * **connection_pool_max_db_connections** - How many connections the pooler can max hold. + How many connections the pooler can max hold. Default is 60. * **connection_pool_mode** - Default pool mode, session or transaction. + Default pool mode, `session` or `transaction`. Default is `transaction`. * **connection_pool_default_cpu_request** **connection_pool_default_memory_reques** **connection_pool_default_cpu_limit** **connection_pool_default_memory_limit** - Default resource configuration for connection pool deployment. + Default resource configuration for connection pool deployment. The internal + default for memory limit and request is `100Mi`, for CPU it is `1`. diff --git a/manifests/configmap.yaml b/manifests/configmap.yaml index 6807d39e3..3b248a4dd 100644 --- a/manifests/configmap.yaml +++ b/manifests/configmap.yaml @@ -18,7 +18,7 @@ data: connection_pool_image: "registry.opensource.zalan.do/acid/pgbouncer:master-5" # connection_pool_max_db_connections: 60 # connection_pool_mode: "transaction" - # connection_pool_number_of_instances: 1 + # connection_pool_number_of_instances: 2 # connection_pool_schema: "pooler" # connection_pool_user: "pooler" # custom_service_annotations: "keyx:valuez,keya:valuea" diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index aa5db341d..483d5c0cb 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -317,7 +317,8 @@ spec: #default: "transaction" connection_pool_number_of_instances: type: integer - #default: 1 + minimum: 2, + #default: 2 connection_pool_default_cpu_limit: type: string pattern: '^(\d+m|\d+(\.\d{1,3})?)$' diff --git a/manifests/postgresql.crd.yaml b/manifests/postgresql.crd.yaml index ec8fe5d5f..06434da14 100644 --- a/manifests/postgresql.crd.yaml +++ b/manifests/postgresql.crd.yaml @@ -84,7 +84,7 @@ spec: - "transaction" numberOfInstances: type: integer - minimum: 1 + minimum: 2 resources: type: object required: diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index 2c4491e68..dc552d3f4 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -105,6 +105,7 @@ var OperatorConfigCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefin var min0 = 0.0 var min1 = 1.0 +var min2 = 2.0 var minDisable = -1.0 // PostgresCRDResourceValidation to check applied manifest parameters @@ -198,7 +199,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{ }, "numberOfInstances": { Type: "integer", - Minimum: &min1, + Minimum: &min2, }, "resources": { Type: "object", @@ -491,7 +492,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{ Type: "string", }, "tls": { - Type: "object", + Type: "object", Required: []string{"secretName"}, Properties: map[string]apiextv1beta1.JSONSchemaProps{ "secretName": { @@ -1166,7 +1167,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation }, "connection_pool_number_of_instances": { Type: "integer", - Minimum: &min1, + Minimum: &min2, }, "connection_pool_schema": { Type: "string",