apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongo
spec:
  selector:
    matchLabels:
      app: mongo # has to match .spec.template.metadata.labels
  serviceName: "mongo-svc"
  replicas: 1 # by default is 1
  template:
    metadata:
      labels:
        app: mongo # has to match .spec.selector.matchLabels
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: mongo
        image: mongo
        ports:
        - containerPort: 27017
          name: mongo
        volumeMounts:
        - name: mongo-ps
          mountPath: /data/db
        env:
          - name: MONGO_INITDB_DATABASE
            value: "strapi-app"
  volumeClaimTemplates:
  - metadata:
      name: mongo-ps
    spec:
      accessModes: [ "ReadWriteOnce" ]
      #storageClassName: "my-storage-class"
      resources:
        requests:
          storage: 1Gi