apiVersion: apps/v1
kind: Deployment
metadata:
  name: concourse-web-deployment
  labels:
    app: concourse-web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: concourse-web
  template:
    metadata:
      labels:
        app: concourse-web
    spec:
      containers:
      - name: concourse-web
        image: concourse/concourse:5.1
        args:
        - web
        env:
        - name: CONCOURSE_EXTERNAL_URL
          valueFrom:
            configMapKeyRef:
              name: concourse-config
              key: external.url
        - name: CONCOURSE_GITHUB_CLIENT_ID
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: github.client.id
        - name: CONCOURSE_GITHUB_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: github.client.secret
        - name: CONCOURSE_MAIN_TEAM_GITHUB_USER
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: github.username
        - name: CONCOURSE_POSTGRES_DATABASE
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.name
        - name: CONCOURSE_POSTGRES_USER
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.user
        - name: CONCOURSE_POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: concourse-secret
              key: database.password
        - name: CONCOURSE_POSTGRES_HOST
          value: concourse-db-service
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: concourse-web-keys
          mountPath: /concourse-keys
      volumes:
        - name: concourse-web-keys
          persistentVolumeClaim:
            claimName: concourse-web-pvc
