apiVersion: apps/v1
kind: Deployment
metadata:
  name: concourse-db-deployment
  labels:
    app: concourse-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: concourse-db
  template:
    metadata:
      labels:
        app: concourse-db
    spec:
      containers:
      - name: concourse-db
        image: postgres:11.2
        env:
        - name: POSTGRES_DB
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.name
        - name: POSTGRES_USER
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.user
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.password
        ports:
        - containerPort: 5432
        volumeMounts:
        - name: postgres-volume
          mountPath: /var/lib/postgresql/data
      volumes:
        - name: postgres-volume
          persistentVolumeClaim:
            claimName: concourse-db-pvc
