---
apiVersion: v1
kind: DeploymentConfig
metadata:
  labels:
    app: fpdc
    service: fpdc
  name: fpdc
spec:
  replicas: 1
  selector:
    app: fpdc
    deploymentconfig: fpdc
  strategy:
    type: Recreate
    recreateParams:
      mid:
        failurePolicy: Abort
        execNewPod:
          containerName: fpdc
          command: ["django-admin", "migrate", "--no-input"]
          env:
          - name: PYTHONPATH
            value: /opt/app-root/src
          - name: DJANGO_SETTINGS_MODULE
            value: fpdc.settings.prod
          volumes:
            - config-volume
      post:
        failurePolicy: Ignore
        execNewPod:
          containerName: fpdc
          command: ["django-admin", "add_permissions", "releng-team"]
          env:
          - name: PYTHONPATH
            value: /opt/app-root/src
          - name: DJANGO_SETTINGS_MODULE
            value: fpdc.settings.prod
          volumes:
            - config-volume
  template:
    metadata:
      labels:
        app: fpdc
        deploymentconfig: fpdc
    spec:
      containers:
      - name: fpdc
        image: fpdc:latest
        ports:
        - containerPort: 8080
        resources: {}
        volumeMounts:
        - name: config-volume
          mountPath: /opt/app-root/config/
          readOnly: true
        readinessProbe:
          timeoutSeconds: 1
          initialDelaySeconds: 5
          httpGet:
            path: /api/v1/
            port: 8080
        livenessProbe:
          timeoutSeconds: 1
          initialDelaySeconds: 30
          httpGet:
            path: /api/v1/
            port: 8080
      volumes:
      - name: config-volume
        configMap:
          name: fpdc-configmap

  triggers:
  - type: ConfigChange
  - type: ImageChange
    imageChangeParams:
      automatic: true
      containerNames:
      - fpdc
      from:
        kind: ImageStreamTag
        name: fpdc:latest
