apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  labels:
    app: sheepbot-db
  name: sheepbot-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sheepbot-db
  strategy: {}
  template:
    metadata:
      labels:
        app: sheepbot-db
    spec:
      containers:
        - image: postgres:12
          name: sheepbot-db
          resources: {}
          imagePullPolicy: "Always"
          ports:
            - containerPort: 5432
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresdb
          env:
          - name: POSTGRES_DB
            valueFrom:
              secretKeyRef:
                name: sheepbot-creds
                key: DATABASE_DB
          - name: POSTGRES_PASSWORD
            valueFrom:
              secretKeyRef:
                name: sheepbot-creds
                key: DATABASE_PASSWORD
      restartPolicy: Always
      volumes:
        - name: postgresdb
          persistentVolumeClaim:
            claimName: sheepbot-postgres-pvc
status: {}
