---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  labels:
    app: toddlers
    service: toddlers
  name: toddlers
spec:
  replicas: 3
  selector:
    app: toddlers
    deploymentconfig: toddlers
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: toddlers
        deploymentconfig: toddlers
    spec:
      containers:
      - name: toddlers
        image: toddlers:latest
        command: ["fedora-messaging", "consume"]
        env:
          - name: PYTHONPATH
            value: "/code"
          - name: KRB5_CONFIG
            value: /etc/ipa/krb5.conf
        resources: {}
        volumeMounts:
        - name: toddlers-secret-volume
          mountPath: /etc/fedora-messaging
          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
        - name: ipa-config-volume
          mountPath: /etc/ipa
          readOnly: true
        - name: keytab-volume
          mountPath: /etc/keytabs
          readOnly: true
        - name: temp-volume
          mountPath: /var/tmp
      volumes:
      - name: toddlers-secret-volume
        secret:
          secretName: toddlers-secret
      - name: fedora-messaging-ca-volume
        secret:
          secretName: toddlers-fedora-messaging-ca
      - name: fedora-messaging-key-volume
        secret:
         secretName: toddlers-fedora-messaging-key
      - name: fedora-messaging-cert-volume
        secret:
          secretName: toddlers-fedora-messaging-crt
      - name: ipa-config-volume
        configMap:
          name: ipa-client-config
      - name: keytab-volume
        secret:
          secretName: toddlers-keytab
      - name: temp-volume

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