apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    origin: diss
    app: diss-db
  name: diss-db
  namespace: diss
spec:
  replicas: 1
  selector:
    matchLabels:
      origin: diss
      app: diss-db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        origin: diss
        app: diss-db
    spec:
      containers:
      - env:
        - name: POSTGRES_DB
          valueFrom:
            configMapKeyRef:
              key: POSTGRES_DB
              name: diss-db-env
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              key: POSTGRES_PASSWORD
              name: diss-db-env-secret
        - name: POSTGRES_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              key: POSTGRES_ROOT_PASSWORD
              name: diss-db-env-secret
        - name: POSTGRES_USER
          valueFrom:
            configMapKeyRef:
              key: POSTGRES_USER
              name: diss-db-env
        image: postgres:9.6
        imagePullPolicy: IfNotPresent
        name: diss-db
        ports:
        - containerPort: 5432
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
          - mountPath: /var/lib/diss/postgres
            name: diss-db-data
            subPath: data
      restartPolicy: Always
      volumes:
      - name: diss-db-data
        emptyDir: {}
