From 4d12615c0d81b9ba142e32f39db80726140cbc7b Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Wed, 4 Mar 2020 10:38:01 +0100 Subject: [PATCH] reflect new pooler parameter in validation + define same pooler image everywhere --- .../crds/operatorconfigurations.yaml | 11 ++++++---- .../postgres-operator/crds/postgresqls.yaml | 21 +++++-------------- manifests/configmap.yaml | 2 +- manifests/operatorconfiguration.crd.yaml | 11 ++++++---- ...gresql-operator-default-configuration.yaml | 2 +- manifests/postgresql.crd.yaml | 2 ++ pkg/apis/acid.zalan.do/v1/crds.go | 12 ++++++++--- pkg/util/config/config.go | 6 +++--- 8 files changed, 35 insertions(+), 32 deletions(-) diff --git a/charts/postgres-operator/crds/operatorconfigurations.yaml b/charts/postgres-operator/crds/operatorconfigurations.yaml index 5979cdf72..a45607905 100644 --- a/charts/postgres-operator/crds/operatorconfigurations.yaml +++ b/charts/postgres-operator/crds/operatorconfigurations.yaml @@ -327,18 +327,21 @@ spec: connection_pool_user: type: string #default: "pooler" - connection_pool_number_of_instances: - type: integer - #default: 1 connection_pool_image: type: string - #default: "registry.opensource.zalan.do/acid/pgbouncer:1.0.0" + #default: "registry.opensource.zalan.do/acid/pgbouncer:master-5" + connection_pool_max_db_connections: + type: integer + #default: 60 connection_pool_mode: type: string enum: - "session" - "transaction" #default: "transaction" + connection_pool_number_of_instances: + type: integer + #default: 1 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 5ba2a3a37..89098d315 100644 --- a/charts/postgres-operator/crds/postgresqls.yaml +++ b/charts/postgres-operator/crds/postgresqls.yaml @@ -111,8 +111,13 @@ spec: properties: dockerImage: type: string + maxDBConnections: + type: integer mode: type: string + enum: + - "session" + - "transaction" numberOfInstances: type: integer minimum: 1 @@ -244,22 +249,6 @@ spec: type: string replicaLoadBalancer: # deprecated type: boolean - connectionPool: - type: object - properties: - schema: - type: string - user: - type: string - number_of_instances: - type: integer - dockerImage: - type: string - mode: - type: string - enum: - - "session" - - "transaction" resources: type: object required: diff --git a/manifests/configmap.yaml b/manifests/configmap.yaml index df15ee36e..f1c5446b0 100644 --- a/manifests/configmap.yaml +++ b/manifests/configmap.yaml @@ -15,7 +15,7 @@ data: # connection_pool_default_cpu_request: "1" # connection_pool_default_memory_limit: 100m # connection_pool_default_memory_request: "100Mi" - connection_pool_image: "registry.opensource.zalan.do/acid/pgbouncer:master-3" + connection_pool_image: "registry.opensource.zalan.do/acid/pgbouncer:master-5" # connection_pool_number_of_instances: 1 # connection_pool_mode: "transaction" # connection_pool_schema: "pooler" diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index dd303ea7e..aa5db341d 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -303,18 +303,21 @@ spec: connection_pool_user: type: string #default: "pooler" - connection_pool_number_of_instances: - type: integer - #default: 1 connection_pool_image: type: string - #default: "registry.opensource.zalan.do/acid/pgbouncer:1.0.0" + #default: "registry.opensource.zalan.do/acid/pgbouncer:master-5" + connection_pool_max_db_connections: + type: integer + #default: 60 connection_pool_mode: type: string enum: - "session" - "transaction" #default: "transaction" + connection_pool_number_of_instances: + type: integer + #default: 1 connection_pool_default_cpu_limit: type: string pattern: '^(\d+m|\d+(\.\d{1,3})?)$' diff --git a/manifests/postgresql-operator-default-configuration.yaml b/manifests/postgresql-operator-default-configuration.yaml index 4f5c9d960..5bc20eae3 100644 --- a/manifests/postgresql-operator-default-configuration.yaml +++ b/manifests/postgresql-operator-default-configuration.yaml @@ -126,7 +126,7 @@ configuration: connection_pool_default_cpu_request: "1" connection_pool_default_memory_limit: 100m connection_pool_default_memory_request: "100Mi" - connection_pool_image: "registry.opensource.zalan.do/acid/pgbouncer:master-3" + connection_pool_image: "registry.opensource.zalan.do/acid/pgbouncer:master-5" connection_pool_number_of_instances: 1 connection_pool_mode: "transaction" # connection_pool_schema: "pooler" diff --git a/manifests/postgresql.crd.yaml b/manifests/postgresql.crd.yaml index c809533a4..4e938319b 100644 --- a/manifests/postgresql.crd.yaml +++ b/manifests/postgresql.crd.yaml @@ -75,6 +75,8 @@ spec: properties: dockerImage: type: string + maxDBConnections: + type: integer mode: type: string enum: diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index fe00189cc..22bac54e0 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -182,6 +182,9 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{ "dockerImage": { Type: "string", }, + "maxDBConnections": { + Type: "integer", + }, "mode": { Type: "string", Enum: []apiextv1beta1.JSON{ @@ -1129,9 +1132,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation "connection_pool_image": { Type: "string", }, - "connection_pool_replicas": { - Type: "integer", - Minimum: &min1, + "connection_pool_max_db_connections": { + Type: "integer", }, "connection_pool_mode": { Type: "string", @@ -1144,6 +1146,10 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation }, }, }, + "connection_pool_number_of_instances": { + Type: "integer", + Minimum: &min1, + }, "connection_pool_schema": { Type: "string", }, diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index dae21a4ee..8f6af5107 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -88,13 +88,13 @@ type ConnectionPool struct { NumberOfInstances *int32 `name:"connection_pool_number_of_instances" default:"1"` Schema string `name:"connection_pool_schema" default:"pooler"` User string `name:"connection_pool_user" default:"pooler"` - Image string `name:"connection_pool_image" default:"pgbouncer:1.0"` - Mode string `name:"connection_pool_mode" default:"session"` + Image string `name:"connection_pool_image" default:"registry.opensource.zalan.do/acid/pgbouncer:master-5"` + Mode string `name:"connection_pool_mode" default:"transaction"` + MaxDBConnections *int32 `name:"connection_pool_max_db_connections" default:"60"` ConnPoolDefaultCPURequest string `name:"connection_pool_default_cpu_request" default:"100m"` ConnPoolDefaultMemoryRequest string `name:"connection_pool_default_memory_request" default:"100Mi"` ConnPoolDefaultCPULimit string `name:"connection_pool_default_cpu_limit" default:"3"` ConnPoolDefaultMemoryLimit string `name:"connection_pool_default_memory_limit" default:"1Gi"` - MaxDBConnections *int32 `name:"connection_pool_max_db_connections" default:"60"` } // Config describes operator config