apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
  name: chat-mongodb
  namespace: juwan
spec:
  members: 1
  type: ReplicaSet
  version: "7.0.32"
  security:
    authentication:
      modes:
        - SCRAM
  users:
    - name: app-user
      db: admin
      passwordSecretRef:
        name: chat-mongodb-app-user-password
      roles:
        - name: readWrite
          db: juwan_chat
      scramCredentialsSecretName: chat-mongodb-app-user-scram
  additionalMongodConfig:
    storage.wiredTiger.engineConfig.journalCompressor: zlib
  statefulSet:
    spec:
      template:
        spec:
          containers:
            - name: mongod
              resources:
                requests:
                  cpu: 30m
                  memory: 80Mi
                limits:
                  memory: 400Mi
            - name: mongodb-agent
              resources:
                requests:
                  cpu: 20m
                  memory: 35Mi
                limits:
                  memory: 100Mi
      volumeClaimTemplates:
        - metadata:
            name: data-volume
          spec:
            accessModes: ["ReadWriteOnce"]
            resources:
              requests:
                storage: 1Gi
        - metadata:
            name: logs-volume
          spec:
            accessModes: ["ReadWriteOnce"]
            resources:
              requests:
                storage: 256Mi
