Skip to content

Cannot create database as admin user. #1148

@Bjohnson131

Description

@Bjohnson131

What did you do to encounter the bug?
Steps to reproduce the behavior:

  1. apply the most recent operator yaml in a namespace
  2. apply this database yaml in the same namespace:
  3. try to log in as "my-user" from mongodb compass
  4. try to create any database
---
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
  name: mongodb
  namespace: default
spec:
  members: 1
  type: ReplicaSet
  version: "6.0.2"
  statefulSet:
    spec:
      volumeClaimTemplates:
        - metadata:
            name: data-volume
          spec:
            accessModes: [ "ReadWriteOnce" ]
            storageClassName: "longhorn"
            resources:
              requests:
                storage: 20Gi
        - metadata:
            name: logs-volume
          spec:
            accessModes: [ "ReadWriteOnce" ]
            storageClassName: "longhorn"
            resources:
              requests:
                storage: 2Gi
  security:
    authentication:
      modes: ["SCRAM"]
  users:
    - name: my-user
      db: admin
      passwordSecretRef: # a reference to the secret that will be used to generate the user's password
        name: my-user-password
      roles:
        - name: clusterAdmin
          db: admin
        - name: userAdminAnyDatabase
          db: admin
      scramCredentialsSecretName: my-scram
  additionalMongodConfig:
    storage.wiredTiger.engineConfig.journalCompressor: zlib

# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
  name: my-user-password
  namespace: default
type: Opaque
stringData:
  password: [whatever]

What did you expect?
I expected to be able to create a database

What happened instead?
not authorized on newdb to execute command { create: "newcollection", lsid: { id: UUID("ef310b16-9dab-4ffd-a4af-04e98b397619") }, $clusterTime: { clusterTime: Timestamp(1668065708, 1), signature: { hash: BinData(0, C4955DD8863109D20A7BC68745801BE04209F547), keyId: 7164285172358053892 } }, $db: "newdb" }

Screenshots
image

Operator Information

  • 0.7.6
  • 6.0.2

Kubernetes Cluster Information

  • vanilla
  • 1.24.7
  • Image Registry location (quay, or an internal registry): quay

Additional context
see line 78 of the log:
mongodb-0-1668066394382142449.log

If possible, please include:

  • kubectl describe output
  • yaml definitions for your objects
  • log files for the operator and database pods

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions