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 [Red Hat 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
+
Note that both the DBaaS Operator and Atlas Operator should be installed through the [Operator Lifecyle Manager (OLM)](https://github.com/operator-framework/operator-lifecycle-manager).
159
+
160
+
**1.** Check DBaaS Registration
161
+
162
+
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.
163
+
164
+
```
165
+
apiVersion: dbaas.redhat.com/v1alpha1
166
+
kind: DBaaSProvider
167
+
metadata:
168
+
labels:
169
+
related-to: dbaas-operator
170
+
type: dbaas-provider-registration
171
+
name: mongodb-atlas-registration
172
+
spec:
173
+
connectionKind: MongoDBAtlasConnection
174
+
credentialFields:
175
+
- displayName: Organization ID
176
+
key: orgId
177
+
required: true
178
+
type: string
179
+
- displayName: Public API Key
180
+
key: publicApiKey
181
+
required: true
182
+
type: string
183
+
- displayName: Private API Key
184
+
key: privateApiKey
185
+
required: true
186
+
type: maskedstring
187
+
inventoryKind: MongoDBAtlasInventory
188
+
provider:
189
+
displayDescription: Cloud-hosted MongoDB service on AWS, Azure and Google Cloud
190
+
displayName: MongoDB Atlas Cloud Database Service
191
+
icon:
192
+
base64data: <icon image data>
193
+
mediatype: image/png
194
+
name: Red Hat DBaaS / MongoDB Atlas
195
+
```
196
+
If the Atlas Operator is undeployed with the OLM, the above registration CR gets cleaned up automatically.
First an administrator creates 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.
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.
267
+
268
+
Here is an example of MongoDBAtlasConnection CR.
269
+
```
270
+
apiVersion: dbaas.redhat.com/v1alpha1
271
+
kind: MongoDBAtlasConnection
272
+
metadata:
273
+
name: test-dbaas-connection
274
+
namespace: test-namespace
275
+
ownerReferences:
276
+
- apiVersion: dbaas.redhat.com/v1alpha1
277
+
blockOwnerDeletion: true
278
+
controller: true
279
+
kind: DBaaSConnection
280
+
name: test-dbaas-connection
281
+
uid: 77193619-6ab1-43c9-acf2-a40c2cfe7703
282
+
spec:
283
+
instanceID: 12345ffbc9a90e310e642482
284
+
inventoryRef:
285
+
name: dbaas-mytest
286
+
namespace: openshift-operators
287
+
status:
288
+
conditions:
289
+
- lastTransitionTime: "2021-08-18T20:07:51Z"
290
+
message: ""
291
+
reason: Ready
292
+
status: "True"
293
+
type: ReadyForBinding
294
+
connectionInfoRef:
295
+
name: atlas-connection-cm-knp9z
296
+
credentialsRef:
297
+
name: atlas-db-user-5pc8b
298
+
```
299
+
The corresponding generated secret:
300
+
```
301
+
apiVersion: v1
302
+
data:
303
+
password: cGFzczEyM3dAcmQ=
304
+
username: ZGJVc2VyXzEwMQ==
305
+
kind: Secret
306
+
metadata:
307
+
labels:
308
+
managed-by: atlas-operator
309
+
owner: test-dbaas-connection
310
+
owner.kind: MongoDBAtlasConnection
311
+
owner.namespace: test-namespace
312
+
name: atlas-db-user-5pc8b
313
+
namespace: test-namespace
314
+
ownerReferences:
315
+
- apiVersion: dbaas.redhat.com/v1alpha1
316
+
blockOwnerDeletion: false
317
+
controller: true
318
+
kind: MongoDBAtlasConnection
319
+
name: test-dbaas-connection
320
+
uid: a50b06db-8fa1-45c9-9893-833a028dfccc
321
+
type: Opaque
322
+
```
323
+
The corresponding generated configmap:
324
+
```
325
+
apiVersion: v1
326
+
data:
327
+
host: cluster0.ubajs.mongodb.net
328
+
provider: Red Hat DBaaS / MongoDB Atlas
329
+
srv: "true"
330
+
type: mongodb
331
+
kind: ConfigMap
332
+
metadata:
333
+
labels:
334
+
managed-by: atlas-operator
335
+
owner: test-dbaas-connection
336
+
owner.kind: MongoDBAtlasConnection
337
+
owner.namespace: test-namespace
338
+
name: atlas-connection-cm-knp9z
339
+
namespace: test-namespace
340
+
ownerReferences:
341
+
- apiVersion: dbaas.redhat.com/v1alpha1
342
+
blockOwnerDeletion: false
343
+
controller: true
344
+
kind: MongoDBAtlasConnection
345
+
name: test-dbaas-connection
346
+
uid: a50b06db-8fa1-45c9-9893-833a028dfccc
347
+
```
154
348
## How to Contribute
155
349
156
350
Please file issues before filing PRs. For PRs to be accepted, contributors must sign
0 commit comments