service-binding-operator icon indicating copy to clipboard operation
service-binding-operator copied to clipboard

Bindings with MongoDB/Percona Distribution for MongoDB operator

Open mhdawson opened this issue 3 years ago • 6 comments

I'm working on mongodb mappings for kube-service-bindings.

I created a mongo database using the Percona Distribution for MongoDB operator as it was listed as one of the compatible operators in the GA announce.

I was then able to drag the service binding connection in the console UI but I can't see how to use the bound information to connect.

What I see as files bound in are:

MONGODB_CLUSTER_ADMIN_USER ca.crt provider ..data/ MONGODB_CLUSTER_MONITOR_PASSWORD clusterIP tls.crt MONGODB_BACKUP_PASSWORD MONGODB_CLUSTER_MONITOR_USER host tls.key MONGODB_BACKUP_USER MONGODB_USER_ADMIN_PASSWORD mongodb-key type MONGODB_CLUSTER_ADMIN_PASSWORD MONGODB_USER_ADMIN_USER password username

I tried using username and password along with host to connect but the authentication fails and I can see the following in the logs for the mongodb instance:

metadata","attr":{"remote":"10.217.1.1:48370","client":"conn13","doc":{"driver":{"name":"nodejs","version":"2.2.36"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"4.18.0-305.19.1.el8_4.x86_64"},"platform":"Node.js v10.24.0, LE, mongodb-core: 2.1.20"}}}
{"t":{"$date":"2021-12-10T21:30:22.928+00:00"},"s":"I",  "c":"ACCESS",   "id":20249,   "ctx":"conn13","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","speculative":false,"principalName":"userAdmin","authenticationDatabase":"admin","remote":"10.217.1.1:48370","extraInfo":{},"error":"UserNotFound: Could not find user \"userAdmin\" for db \"admin\""}}

it looks like userAdmin is the what is in the username file and I believe i'm using what is in the password file, and I must have the host right as the connection hits the database since I can see the auth failure in the log.

There is no info in the bindings with respect to the database name so I assume the default is admin and there is no info in the bindings info to suggest a different one.

For the connection string it's in the form mongodb://username:[email protected]

Can you point me at any additional info about what's being mapped in or suggest what I might be doing wrong in the connection?

mhdawson avatar Dec 10 '21 21:12 mhdawson

@pedjak any suggestions?

mhdawson avatar Jan 06 '22 21:01 mhdawson

I think my current problems may be related to getting the mongo database to come up (the anti affinity rules don't seem to like my CRC environment). @pedjak do you have an environment where you have the Percona operator installed that I might use for testing as I'm not able to make any progress.

mhdawson avatar Jan 21 '22 23:01 mhdawson

I tried a cluster bot instance but still no luck. The Mongodb cluster just stays stuck at initializing. I'm hoping it's something easy that I'm missing but I just can't find it :(

mhdawson avatar Jan 25 '22 00:01 mhdawson

We are working on a blog which demonstrates binding an application to MongoDB Percona operator and it will be helpful.

Kartikey-star avatar May 19 '22 12:05 Kartikey-star

@Kartikey-star thanks, looking forward to that.

mhdawson avatar May 25 '22 14:05 mhdawson

@shruthihub Please update this when the blog is published.

baijum avatar Jul 14 '22 12:07 baijum

We have published a blog series:

  • Part 1: https://developers.redhat.com/articles/2022/11/10/set-openshift-cluster-deploy-application-odo-cli#
  • Part 2: https://developers.redhat.com/articles/2022/11/10/implement-restapi-application-mongodb-using-sbo#

Closing!

baijum avatar Nov 10 '22 13:11 baijum