apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongo
spec:
  selector:
    matchLabels:
      app: mongo
  serviceName: "mongo"
  replicas: 1
  template:
    metadata:
      labels:
        app: mongo
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: mongo
        image: mongo:4.2
        ports:
        - containerPort: 27017
        volumeMounts:
        - name: mongo-persistent-storage
          mountPath: /data/db
        resources:
          limits:
            memory: "2Gi"
            cpu: "1"
          requests:
            memory: "128Mi"
            cpu: "100m"
      nodeSelector:
        intendedfor: krm-services
  # TODO: look to switch to: 
  # https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/preexisting-pd
  volumeClaimTemplates:
  - metadata:
      name: mongo-persistent-storage
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 10Gi
