service-binding-operator
service-binding-operator copied to clipboard
Bindings with MongoDB/Percona Distribution for MongoDB operator
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?
@pedjak any suggestions?
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.
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 :(
We are working on a blog which demonstrates binding an application to MongoDB Percona operator and it will be helpful.
@Kartikey-star thanks, looking forward to that.
@shruthihub Please update this when the blog is published.
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!