Skip to content

Commit 31e15ea

Browse files
committed
Describe how to use existing users
Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
1 parent 630e902 commit 31e15ea

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

docs/database.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,24 @@ USER: << base64 encoded user name (generated by db operator) >>
252252

253253
Then DB Operator will connect to an existing database and set up a user for it.
254254

255+
256+
## Using an existing user
257+
258+
Since version **2.22.0** it's possible to make DB Operator grant access to a database to an existing user instead of generating a new one. To do so add `.spec.existingUser: ${USERNAME}` to your manifest.
259+
260+
```yaml
261+
kind: Database
262+
metadata: {}
263+
spec:
264+
existingUser: my-db-user
265+
```
266+
267+
When using an existing user, DB Operator is not aware of the password anymore, hence the **password** field in the credentials Secret will be empty. Users must handle the authentication on their own.
268+
269+
It's also important to understand, that when you are switching **from/to** existing user **to/from** a generated one, you need to remove the Secret from the cluster, so it's recreated, otherwise it's either going to be empty for a generated user, or filled for an existing one. It will most probably be fixed in future versions.
270+
271+
Another thing that is worth mentioning, DB Operator is running a health check on each reconciliation, and with generated users it's trying to access a database using these users, but as DB Operator is not aware of a password of an existing users, it's performing a health check as an admin, and hence can't verify whether a user really has the required access.
272+
255273
## Experimental features
256274

257275
Experimental features are added via annotations, the following features are available for `Databases`

docs/dbuser.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ spec:
6060
6161
This metadata can be used by external controllers that watch annotations or require specific labels to enable Secret synchronization or reflection across namespaces.
6262
63+
## Using an existing user
64+
65+
Since version **2.22.0** it's possible to make DB Operator grant access to a database to an existing user instead of generating a new one. To do so add `.spec.existingUser: ${USERNAME}` to your manifest.
66+
67+
```yaml
68+
kind: DbUser
69+
metadata: {}
70+
spec:
71+
existingUser: my-db-user
72+
```
73+
74+
When using an existing user, DB Operator is not aware of the password anymore, hence the **password** field in the credentials Secret will be empty. Users must handle the authentication on their own.
75+
76+
It's also important to understand, that when you are switching **from/to** existing user **to/from** a generated one, you need to remove the Secret from the cluster, so it's recreated, otherwise it's either going to be empty for a generated user, or filled for an existing one. It will most probably be fixed in future versions.
77+
6378
## Experimental features
6479

6580
Experimental features are added via annotations, the following features are available for `DbUsers`

0 commit comments

Comments
 (0)