apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  namespace: my-ripsaw
spec:
  serviceName: "postgres"
  selector:
    matchLabels:
      app: postgres
  replicas: 1
  template:
    metadata:
      labels:
        role: postgres
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:10.4
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: postgres-config
          volumeMounts:
            - name: postgres-persistent-storage
              mountPath: /var/lib/postgresql/data
  volumeClaimTemplates:
    - metadata:
        name: postgres-persistent-storage
        annotations:
          volume.beta.kubernetes.io/storage-class: ocs-storagecluster-ceph-rbd
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 10Gi
