Unable to create database
Closed this issue · 1 comments
Bug Description
I'm trying to figure out how to integrate a charm with mongodb-k8s, so I've modified an existing charm to do this, by following the documentation instructions on https://charmhub.io/data-platform-libs/libraries/database_requires. However, when I relate my charm to the mongodb-k8s charm, the database isn't created and so no DatabaseCreatedEvent
is triggered and there's no connection information over the relation.
It's possible I'm doing something wrong in my charm implmentation. Any feedback on that appreciated.
To Reproduce
- git clone -b mongodb-relation https://github.com/mthaddon/gunicorn-k8s-operator
- cd gunicorn-k8s-operator
- charmcraft pack
- juju deploy gunicorn-k8s_ubuntu-20.04-amd64.charm --resource gunicorn-image='gunicorncharmers/gunicorn-app:edge'
- git clone https://github.com/delgod/mongodb-k8s-operator
- cd mongdb-k8s-operator
- charmcraft pack
- juju deploy ./mongodb-k8s_ubuntu-20.04-amd64.charm --resource mongodb-image=mongo:4.4
- juju relate mongodb-k8s gunicorn-k8s
- Wait for relation to settle
- View juju debug-log as well as juju show-unit output, see that there's no database been created in mongodb
microk8s kubectl exec -ti -n g-test -c mongod mongodb-k8s-0 -- /bin/bash; mongo; show dbs
.
Environment
I'm using microk8s 1.25, juju 2.9.34
Relevant log output
Please see https://paste.ubuntu.com/p/hQYMvpnHV9/
Additional context
N/A
fixed in #32
NB: please use the following command to check if credentials work correctly
microk8s kubectl exec -n testing mongodb-k8s-0 -c mongod -it -- mongo "$(juju show-unit gunicorn-k8s/0 | grep uris | awk '{print$2}')" --eval 'db.inventory.insertOne({item: "canvas"}); db.adminCommand({listDatabases: 1})'
The reason behind: it is needed to push one document into the database before show dbs
will show it.