diff --git a/charts/postgres-operator/crds/operatorconfigurations.yaml b/charts/postgres-operator/crds/operatorconfigurations.yaml index c7325907a..5979cdf72 100644 --- a/charts/postgres-operator/crds/operatorconfigurations.yaml +++ b/charts/postgres-operator/crds/operatorconfigurations.yaml @@ -327,7 +327,7 @@ spec: connection_pool_user: type: string #default: "pooler" - connection_pool_replicas: + connection_pool_number_of_instances: type: integer #default: 1 connection_pool_image: diff --git a/charts/postgres-operator/crds/postgresqls.yaml b/charts/postgres-operator/crds/postgresqls.yaml index 1efdbc7b7..5ba2a3a37 100644 --- a/charts/postgres-operator/crds/postgresqls.yaml +++ b/charts/postgres-operator/crds/postgresqls.yaml @@ -251,7 +251,7 @@ spec: type: string user: type: string - replicas: + number_of_instances: type: integer dockerImage: type: string diff --git a/charts/postgres-operator/values-crd.yaml b/charts/postgres-operator/values-crd.yaml index cc16a0979..bb40011ed 100644 --- a/charts/postgres-operator/values-crd.yaml +++ b/charts/postgres-operator/values-crd.yaml @@ -263,7 +263,7 @@ configScalyr: configConnectionPool: # number of pooler instances - connection_pool_replicas: 1 + connection_pool_number_of_instances: 1 # db schema to install lookup function into connection_pool_schema: "pooler" # db user for pooler to use diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index 1f4cb6f70..1a028addd 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -240,7 +240,7 @@ configTeamsApi: # configure connection pooler deployment created by the operator configConnectionPool: # number of pooler instances - connection_pool_replicas: 1 + connection_pool_number_of_instances: 1 # db schema to install lookup function into connection_pool_schema: "pooler" # db user for pooler to use diff --git a/docs/reference/cluster_manifest.md b/docs/reference/cluster_manifest.md index a49890d13..da4756ca6 100644 --- a/docs/reference/cluster_manifest.md +++ b/docs/reference/cluster_manifest.md @@ -372,7 +372,7 @@ configuration for connection pool. If this section is not empty, a connection pool will be created for a database even if `enableConnectionPool` is not present. -* **replicas** +* **number_of_instances** How many instances of connection pool to create. * **mode** diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 52d4e66c1..665a4c992 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -600,7 +600,7 @@ default configuration for connection pool, if a postgres manifest requests it 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_replicas** +* **connection_pool_number_of_instances** How many instances of connection pool to create. * **connection_pool_schema** diff --git a/docs/user.md b/docs/user.md index 7758d1c34..64e5b98d1 100644 --- a/docs/user.md +++ b/docs/user.md @@ -478,7 +478,7 @@ To configure a new connection pool, specify: spec: connectionPool: # how many instances of connection pool to create - replicas: 1 + number_of_instances: 1 # in which mode to run, session or transaction mode: "transaction" diff --git a/manifests/configmap.yaml b/manifests/configmap.yaml index 6d02f0f58..d94e0ec55 100644 --- a/manifests/configmap.yaml +++ b/manifests/configmap.yaml @@ -16,7 +16,7 @@ data: # connection_pool_default_memory_limit: 100m # connection_pool_default_memory_request: "100Mi" # connection_pool_image: "" - # connection_pool_replicas: 1 + # connection_pool_number_of_instances: 1 # connection_pool_mode: "transaction" # connection_pool_schema: "pooler" # connection_pool_user: "pooler" diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index 1c4443ba3..dd303ea7e 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -303,7 +303,7 @@ spec: connection_pool_user: type: string #default: "pooler" - connection_pool_replicas: + connection_pool_number_of_instances: type: integer #default: 1 connection_pool_image: diff --git a/manifests/postgresql-operator-default-configuration.yaml b/manifests/postgresql-operator-default-configuration.yaml index 5a190e2ab..d627767cd 100644 --- a/manifests/postgresql-operator-default-configuration.yaml +++ b/manifests/postgresql-operator-default-configuration.yaml @@ -127,7 +127,7 @@ configuration: 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_replicas: 1 + connection_pool_number_of_instances: 1 connection_pool_mode: "transaction" # connection_pool_schema: "pooler" # connection_pool_user: "pooler" diff --git a/manifests/postgresql.crd.yaml b/manifests/postgresql.crd.yaml index a85c81043..caee35ab0 100644 --- a/manifests/postgresql.crd.yaml +++ b/manifests/postgresql.crd.yaml @@ -215,7 +215,7 @@ spec: type: string user: type: string - replicas: + number_of_instances: type: integer dockerImage: type: string 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 dd0822c6a..bfdf61eda 100644 --- a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go +++ b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go @@ -154,7 +154,7 @@ type ScalyrConfiguration struct { // Defines default configuration for connection pool type ConnectionPoolConfiguration struct { - Replicas *int32 `json:"connection_pool_replicas,omitempty"` + NumberOfInstances *int32 `json:"connection_pool_number_of_instances,omitempty"` Schema string `json:"connection_pool_schema,omitempty"` User string `json:"connection_pool_user,omitempty"` Image string `json:"connection_pool_image,omitempty"` diff --git a/pkg/apis/acid.zalan.do/v1/postgresql_type.go b/pkg/apis/acid.zalan.do/v1/postgresql_type.go index e7965f893..2679f51e1 100644 --- a/pkg/apis/acid.zalan.do/v1/postgresql_type.go +++ b/pkg/apis/acid.zalan.do/v1/postgresql_type.go @@ -169,11 +169,11 @@ type PostgresStatus struct { // makes sense to expose. E.g. pool size (min/max boundaries), max client // connections etc. type ConnectionPool struct { - Replicas *int32 `json:"replicas,omitempty"` - Schema string `json:"schema,omitempty"` - User string `json:"user,omitempty"` - Mode string `json:"mode,omitempty"` - DockerImage string `json:"dockerImage,omitempty"` + NumberOfInstances *int32 `json:"number_of_instances,omitempty"` + Schema string `json:"schema,omitempty"` + User string `json:"user,omitempty"` + Mode string `json:"mode,omitempty"` + DockerImage string `json:"dockerImage,omitempty"` Resources `json:"resources,omitempty"` } diff --git a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go index bc8e0d711..a71e17d1f 100644 --- a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go +++ b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go @@ -71,8 +71,8 @@ func (in *CloneDescription) DeepCopy() *CloneDescription { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConnectionPool) DeepCopyInto(out *ConnectionPool) { *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas + if in.NumberOfInstances != nil { + in, out := &in.NumberOfInstances, &out.NumberOfInstances *out = new(int32) **out = **in } @@ -93,8 +93,8 @@ func (in *ConnectionPool) DeepCopy() *ConnectionPool { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConnectionPoolConfiguration) DeepCopyInto(out *ConnectionPoolConfiguration) { *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas + if in.NumberOfInstances != nil { + in, out := &in.NumberOfInstances, &out.NumberOfInstances *out = new(int32) **out = **in } diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index b9f8e1992..3121691d9 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1861,9 +1861,9 @@ func (c *Cluster) generateConnPoolDeployment(spec *acidv1.PostgresSpec) ( *appsv1.Deployment, error) { podTemplate, err := c.generateConnPoolPodTemplate(spec) - numberOfInstances := spec.ConnectionPool.Replicas + numberOfInstances := spec.ConnectionPool.NumberOfInstances if numberOfInstances == nil { - numberOfInstances = c.OpConfig.ConnectionPool.Replicas + numberOfInstances = c.OpConfig.ConnectionPool.NumberOfInstances } if err != nil { diff --git a/pkg/cluster/sync_test.go b/pkg/cluster/sync_test.go index f5887dede..c6928a64e 100644 --- a/pkg/cluster/sync_test.go +++ b/pkg/cluster/sync_test.go @@ -99,14 +99,14 @@ func TestConnPoolSynchronization(t *testing.T) { oldSpec: &acidv1.Postgresql{ Spec: acidv1.PostgresSpec{ ConnectionPool: &acidv1.ConnectionPool{ - Replicas: int32ToPointer(1), + NumberOfInstances: int32ToPointer(1), }, }, }, newSpec: &acidv1.Postgresql{ Spec: acidv1.PostgresSpec{ ConnectionPool: &acidv1.ConnectionPool{ - Replicas: int32ToPointer(2), + NumberOfInstances: int32ToPointer(2), }, }, }, diff --git a/pkg/controller/operator_config.go b/pkg/controller/operator_config.go index a4a32abba..ecec0307f 100644 --- a/pkg/controller/operator_config.go +++ b/pkg/controller/operator_config.go @@ -146,13 +146,13 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur // Connection pool. Looks like we can't use defaulting in CRD before 1.17, // so ensure default values here. - result.ConnectionPool.Replicas = fromCRD.ConnectionPool.Replicas - if result.ConnectionPool.Replicas == nil || - *result.ConnectionPool.Replicas < 1 { + result.ConnectionPool.NumberOfInstances = fromCRD.ConnectionPool.NumberOfInstances + if result.ConnectionPool.NumberOfInstances == nil || + *result.ConnectionPool.NumberOfInstances < 1 { var value int32 value = 1 - result.ConnectionPool.Replicas = &value + result.ConnectionPool.NumberOfInstances = &value } result.ConnectionPool.Schema = util.Coalesce( diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index b04206d53..91c1acc0a 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -85,7 +85,7 @@ type LogicalBackup struct { // Operator options for connection pooler type ConnectionPool struct { - Replicas *int32 `name:"connection_pool_replicas" default:"1"` + 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"`