diff --git a/CHANGELOG.md b/CHANGELOG.md index 44511a7b9..d0b57f10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## [MAJOR.MINOR.PATCH] - YYYY-MM-DD +## v0.16.1 - YYYY-MM-DD + - Check VPC for running services before deletion +- Expose `CONNECTIONPOOL_NAME` in `ConnectionPool` secret ## v0.16.0 - 2023-12-07 diff --git a/api/v1alpha1/connectionpool_types.go b/api/v1alpha1/connectionpool_types.go index fcd83ab21..237d32e1c 100644 --- a/api/v1alpha1/connectionpool_types.go +++ b/api/v1alpha1/connectionpool_types.go @@ -35,7 +35,7 @@ type ConnectionPoolSpec struct { PoolMode string `json:"poolMode,omitempty"` // Information regarding secret creation. - // Exposed keys: `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI` + // Exposed keys: `CONNECTIONPOOL_NAME`, `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI` ConnInfoSecretTarget ConnInfoSecretTarget `json:"connInfoSecretTarget,omitempty"` // Authentication reference to Aiven token in a secret diff --git a/charts/aiven-operator-crds/templates/aiven.io_connectionpools.yaml b/charts/aiven-operator-crds/templates/aiven.io_connectionpools.yaml index 7b303bd10..f8b3d4399 100644 --- a/charts/aiven-operator-crds/templates/aiven.io_connectionpools.yaml +++ b/charts/aiven-operator-crds/templates/aiven.io_connectionpools.yaml @@ -69,9 +69,9 @@ spec: type: object connInfoSecretTarget: description: 'Information regarding secret creation. Exposed keys: - `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, - `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, - `CONNECTIONPOOL_DATABASE_URI`' + `CONNECTIONPOOL_NAME`, `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, + `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, + `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`' properties: annotations: additionalProperties: diff --git a/config/crd/bases/aiven.io_connectionpools.yaml b/config/crd/bases/aiven.io_connectionpools.yaml index 7b303bd10..f8b3d4399 100644 --- a/config/crd/bases/aiven.io_connectionpools.yaml +++ b/config/crd/bases/aiven.io_connectionpools.yaml @@ -69,9 +69,9 @@ spec: type: object connInfoSecretTarget: description: 'Information regarding secret creation. Exposed keys: - `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, - `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, - `CONNECTIONPOOL_DATABASE_URI`' + `CONNECTIONPOOL_NAME`, `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, + `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, + `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`' properties: annotations: additionalProperties: diff --git a/controllers/connectionpool_controller.go b/controllers/connectionpool_controller.go index d3843a8a6..4b3d0bc54 100644 --- a/controllers/connectionpool_controller.go +++ b/controllers/connectionpool_controller.go @@ -143,6 +143,7 @@ func (h ConnectionPoolHandler) get(ctx context.Context, avn *aiven.Client, obj c if len(connPool.Spec.Username) == 0 { prefix := getSecretPrefix(connPool) stringData := map[string]string{ + prefix + "NAME": connPool.Name, prefix + "HOST": s.URIParams["host"], prefix + "PORT": s.URIParams["port"], prefix + "DATABASE": cp.Database, @@ -170,6 +171,7 @@ func (h ConnectionPoolHandler) get(ctx context.Context, avn *aiven.Client, obj c prefix := getSecretPrefix(connPool) stringData := map[string]string{ + prefix + "NAME": connPool.Name, prefix + "HOST": s.URIParams["host"], prefix + "PORT": s.URIParams["port"], prefix + "DATABASE": cp.Database, diff --git a/docs/docs/api-reference/connectionpool.md b/docs/docs/api-reference/connectionpool.md index 277574049..53e500e1d 100644 --- a/docs/docs/api-reference/connectionpool.md +++ b/docs/docs/api-reference/connectionpool.md @@ -57,7 +57,7 @@ ConnectionPoolSpec defines the desired state of ConnectionPool. **Optional** - [`authSecretRef`](#spec.authSecretRef-property){: name='spec.authSecretRef-property'} (object). Authentication reference to Aiven token in a secret. See below for [nested schema](#spec.authSecretRef). -- [`connInfoSecretTarget`](#spec.connInfoSecretTarget-property){: name='spec.connInfoSecretTarget-property'} (object). Information regarding secret creation. Exposed keys: `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`. See below for [nested schema](#spec.connInfoSecretTarget). +- [`connInfoSecretTarget`](#spec.connInfoSecretTarget-property){: name='spec.connInfoSecretTarget-property'} (object). Information regarding secret creation. Exposed keys: `CONNECTIONPOOL_NAME`, `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`. See below for [nested schema](#spec.connInfoSecretTarget). - [`poolMode`](#spec.poolMode-property){: name='spec.poolMode-property'} (string, Enum: `session`, `transaction`, `statement`). Mode the pool operates in (session, transaction, statement). - [`poolSize`](#spec.poolSize-property){: name='spec.poolSize-property'} (integer). Number of connections the pool may create towards the backend server. @@ -76,7 +76,7 @@ Authentication reference to Aiven token in a secret. _Appears on [`spec`](#spec)._ -Information regarding secret creation. Exposed keys: `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`. +Information regarding secret creation. Exposed keys: `CONNECTIONPOOL_NAME`, `CONNECTIONPOOL_HOST`, `CONNECTIONPOOL_PORT`, `CONNECTIONPOOL_DATABASE`, `CONNECTIONPOOL_USER`, `CONNECTIONPOOL_PASSWORD`, `CONNECTIONPOOL_SSLMODE`, `CONNECTIONPOOL_DATABASE_URI`. **Required** diff --git a/tests/connectionpool_test.go b/tests/connectionpool_test.go index 98a14e334..164257c09 100644 --- a/tests/connectionpool_test.go +++ b/tests/connectionpool_test.go @@ -157,6 +157,7 @@ func TestConnectionPool(t *testing.T) { assert.NotEmpty(t, secret.Data["DATABASE_URI"]) // New secrets + assert.Equal(t, poolName, string(secret.Data["CONNECTIONPOOL_NAME"])) assert.NotEmpty(t, secret.Data["CONNECTIONPOOL_HOST"]) assert.NotEmpty(t, secret.Data["CONNECTIONPOOL_PORT"]) assert.NotEmpty(t, secret.Data["CONNECTIONPOOL_DATABASE"])