---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: database
  # namespace: default
spec:
  serviceName: database-service
  replicas: 1
  selector:
    matchLabels:
      app: database # has to match .spec.template.metadata.labels
  template:
    metadata:
      labels:
        app: database # has to match .spec.selector.matchLabels
      annotations:
        dapr.io/enabled: "true"
        dapr.io/app-id: "database"
        dapr.io/app-port: "27017"
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: database
        command: ["mongod"]
        args: ["--dbpath=/data/db", "--bind_ip_all"] # , "--auth", "--keyFile", "/data/db/keyfile", "--replSet", "rs0"
        image: mongo:latest
        ports:
        - containerPort: 27017
          name: database
        volumeMounts:
        - name: mongodb-data
          mountPath: /data/db # must match configmap dbPath and "command" args
      volumes:
      - name: mongodb-data
        persistentVolumeClaim:
          claimName: database-pvc
