You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Step 4. Test Database as a Service (DBaaS) on OpenShift
155
+
156
+
The Atlas Operator is integrated with the [OpenShift Database Access Operator, a.k.a. Database-as-a-Service (DBaaS) Operator](https://github.com/RHEcosystemAppEng/dbaas-operator) which allows application developers to import database instances and connect to the databases through the [Service Binding Operator](https://github.com/redhat-developer/service-binding-operator). More information can be found [here](https://github.com/RHEcosystemAppEng/dbaas-operator#readme).
157
+
158
+
**1.** Check DBaaS Registration
159
+
160
+
If the DBaaS Operator has been deployed in the OpenShift Cluster, the Atlas Operator automatically creates a cluster level [DBaaSProvider](https://github.com/RHEcosystemAppEng/dbaas-operator/blob/main/config/crd/bases/dbaas.redhat.com_dbaasproviders.yaml) custom resource (CR) object `mongodb-atlas-registration` to automatically register itself with the DBaaS Operator. See file `config/dbaasprovider/dbaas_provider.yaml` for the content of the registration CR.
161
+
If the Atlas Operator is undeployed with the OLM, the above registration CR gets cleaned up automatically.
First an administrator imports a provider account by creating a [DBaaSInventory](https://github.com/RHEcosystemAppEng/dbaas-operator/blob/main/config/crd/bases/dbaas.redhat.com_dbaasinventories.yaml) CR for MongoDB. The DBaaS Operator automatically creates a MongoDBAtlasInventory CR, and the Atlas Operator discovers the clusters and instances, and sets the result in the CR status.
The administrator or developer can then optionally provision an Atlas Deployment by creating a [DBaaSInstance](https://github.com/RHEcosystemAppEng/dbaas-operator/blob/main/config/crd/bases/dbaas.redhat.com_dbaasinstances.yaml) CR. The DBaaS Operator automatically creates a MongoDBAtlasInstance CR, and the Atlas Operator provisions the Atlas Deployment and sets the result in the CR status.
Now the application developer can create a [DBaaSConnection](https://github.com/RHEcosystemAppEng/dbaas-operator/blob/main/config/crd/bases/dbaas.redhat.com_dbaasconnections.yaml) CR for connection to the MongoDB database instance found, the DBaaS Operator automatically creates a MongoDBAtlasConnection CR. The Atlas Operator creates a database user in Atlas for the cluster with the default database `admin`. The Atlas Operator stores the db user credentials in a kubernetes secret, and the remaining connection information in a configmap and then updates the MongoDBAtlasConnection CR status.
263
+
264
+
Here is an example of MongoDBAtlasConnection CR.
265
+
```
266
+
apiVersion: dbaas.redhat.com/v1beta1
267
+
kind: MongoDBAtlasConnection
268
+
metadata:
269
+
name: test-dbaas-connection
270
+
namespace: test-namespace
271
+
ownerReferences:
272
+
- apiVersion: dbaas.redhat.com/v1beta1
273
+
blockOwnerDeletion: true
274
+
controller: true
275
+
kind: DBaaSConnection
276
+
name: test-dbaas-connection
277
+
uid: 77193619-6ab1-43c9-acf2-a40c2cfe7703
278
+
spec:
279
+
databaseServiceID: 12345ffbc9a90e310e642482
280
+
inventoryRef:
281
+
name: dbaas-mytest
282
+
namespace: openshift-operators
283
+
status:
284
+
conditions:
285
+
- lastTransitionTime: "2023-03-28T20:06:56Z"
286
+
message: ""
287
+
reason: Ready
288
+
status: "True"
289
+
type: ReadyForBinding
290
+
connectionInfoRef:
291
+
name: atlas-connection-cm-knp9z
292
+
credentialsRef:
293
+
name: atlas-db-user-5pc8b
294
+
```
295
+
The corresponding generated secret:
296
+
```
297
+
apiVersion: v1
298
+
data:
299
+
password: cGFzczEyM3dAcmQ=
300
+
username: ZGJVc2VyXzEwMQ==
301
+
kind: Secret
302
+
metadata:
303
+
labels:
304
+
managed-by: atlas-operator
305
+
owner: test-dbaas-connection
306
+
owner.kind: MongoDBAtlasConnection
307
+
owner.namespace: test-namespace
308
+
name: atlas-db-user-5pc8b
309
+
namespace: test-namespace
310
+
ownerReferences:
311
+
- apiVersion: dbaas.redhat.com/v1beta1
312
+
blockOwnerDeletion: false
313
+
controller: true
314
+
kind: MongoDBAtlasConnection
315
+
name: test-dbaas-connection
316
+
uid: a50b06db-8fa1-45c9-9893-833a028dfccc
317
+
type: Opaque
318
+
```
319
+
The corresponding generated configmap:
320
+
```
321
+
apiVersion: v1
322
+
data:
323
+
host: cluster0.ubajs.mongodb.net
324
+
provider: OpenShift Datase Access / MongoDB Atlas
325
+
srv: "true"
326
+
type: mongodb
327
+
kind: ConfigMap
328
+
metadata:
329
+
labels:
330
+
managed-by: atlas-operator
331
+
owner: test-dbaas-connection
332
+
owner.kind: MongoDBAtlasConnection
333
+
owner.namespace: test-namespace
334
+
name: atlas-connection-cm-knp9z
335
+
namespace: test-namespace
336
+
ownerReferences:
337
+
- apiVersion: dbaas.redhat.com/v1beta1
338
+
blockOwnerDeletion: false
339
+
controller: true
340
+
kind: MongoDBAtlasConnection
341
+
name: test-dbaas-connection
342
+
uid: a50b06db-8fa1-45c9-9893-833a028dfccc
343
+
```
154
344
## How to Contribute
155
345
156
346
Please file issues before filing PRs. For PRs to be accepted, contributors must sign
0 commit comments