apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: enmasse
  name: alertmanager
spec:
  replicas: 1
  selector:
    matchLabels:
      app: enmasse
      name: alertmanager
  template:
    metadata:
      labels:
        app: enmasse
        name: alertmanager
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              preference:
                matchExpressions:
                  - key: node-role.enmasse.io/operator-infra
                    operator: In
                    values:
                      - "true"
      containers:
      - image: prom/alertmanager:v0.15.2
        imagePullPolicy: Always
        name: alertmanager
        volumeMounts:
        - mountPath: /etc/alertmanager
          name: alertmanager-config
          readOnly: true
        ports:
        - containerPort: 9093
          name: alertmanager
      - image: openshift/oauth-proxy:latest
        imagePullPolicy: Always
        name: oauth-proxy
        ports:
        - containerPort: 8443
          name: proxy
        args:
        - --https-address=:8443
        - --provider=openshift
        - --openshift-service-account=alertmanager-server
        - --upstream=http://localhost:9093
        - --tls-cert=/etc/tls/private/tls.crt
        - --tls-key=/etc/tls/private/tls.key
        - --cookie-secret=SECRET
        volumeMounts:
        - mountPath: /etc/tls/private
          name: alertmanager-proxy-cert
      serviceAccountName: alertmanager-server
      volumes:
      - configMap:
          name: alertmanager-config
        name: alertmanager-config
      - name: alertmanager-proxy-cert
        secret:
          secretName: alertmanager-proxy-cert
