---
apiVersion: v1
kind: DeploymentConfig
metadata:
  labels:
    app: fedocal
    service: fedocal
  name: fedocal
spec:
  replicas: 1
  selector:
    app: fedocal
    deploymentconfig: fedocal
  strategy:
    type: Recreate
    recreateParams:
#      mid:
#        failurePolicy: Abort
#        execNewPod:
#          containerName: fedocal
#          command: ["alembic", "upgrade", "head", "-c", "/opt/app-root/config/alembic.ini"]
#          env:
#          - name: PYTHONPATH
#            value: /opt/app-root/src
#          volumes:
#            - config-volume
  template:
    metadata:
      labels:
        app: fedocal
        deploymentconfig: fedocal
    spec:
      containers:
      - name: fedocal
        image: fedocal:latest
        ports:
        - containerPort: 8080
        resources: {}
        volumeMounts:
        - name: config-volume
          mountPath: /opt/app-root/config/
          readOnly: true
        - name: secret-volume
          mountPath: /opt/app-root/secret/
          readOnly: true
        - name: fedora-messaging-ca-volume
          mountPath: /etc/pki/rabbitmq/ca
          readOnly: true
        - name: fedora-messaging-key-volume
          mountPath: /etc/pki/rabbitmq/key
          readOnly: true
        - name: fedora-messaging-cert-volume
          mountPath: /etc/pki/rabbitmq/cert
          readOnly: true
        readinessProbe:
          timeoutSeconds: 1
          initialDelaySeconds: 5
          httpGet:
            path: /
            port: 8080
        livenessProbe:
          timeoutSeconds: 1
          initialDelaySeconds: 30
          httpGet:
            path: /
            port: 8080
      volumes:
      - name: config-volume
        configMap:
          name: fedocal-configmap
      - name: secret-volume
        secret:
          secretName: fedocal-secret
      - name: fedora-messaging-ca-volume
        secret:
          secretName: fedocal-fedora-messaging-ca
      - name: fedora-messaging-key-volume
        secret:
          secretName: fedocal-fedora-messaging-key
      - name: fedora-messaging-cert-volume
        secret:
          secretName: fedocal-fedora-messaging-crt

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