apiVersion: apps/v1
kind: Deployment
metadata:
  name: hw-event-proxy
  namespace: cloud-native-events
  labels:
    app: hw-event-proxy
  annotations:
    release.openshift.io/version: "{{.ReleaseVersion}}"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hw-event-proxy
  template:
    metadata:
      labels:
        app: hw-event-proxy
    spec:
      serviceAccountName: hw-event-proxy-sa
      containers:
        - name: cloud-native-event-handler
          image: quay.io/jacding/cloud-event-proxy:latest
          args:
            - "--metrics-addr=127.0.0.1:9091"
            - "--store-path=/store"
            - "--transport-host=amqp://amq-interconnect.amqp.svc.cluster.local"
            - "--api-port=8080"
          volumeMounts:
            - name: pubsubstore
              mountPath: /store
          ports:
            - name: hw-event-port
              containerPort: 9087
            - name: metrics-port
              containerPort: 9091
          env:
            - name: HW_PLUGIN
              value: "true"
            - name: HW_EVENT_PORT
              value: "9087"
            - name: MY_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: MY_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MY_POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
        - name: kube-rbac-proxy
          image: quay.io/coreos/kube-rbac-proxy:v0.5.0
          imagePullPolicy: Always
          args:
            - --logtostderr
            - --secure-listen-address=:8443
            - --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
            - --upstream=http://127.0.0.1:9091/
            - --tls-private-key-file=/etc/metrics/tls.key
            - --tls-cert-file=/etc/metrics/tls.crt
          ports:
            - containerPort: 8443
              name: https
          resources:
            requests:
              cpu: 10m
              memory: 20Mi
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
            - name: hw-event-plugin-certs
              mountPath: /etc/metrics
              readOnly: True
      volumes:
        - name: pubsubstore
          emptyDir: {}
        - name: hw-event-plugin-certs
          secret:
            secretName: hw-event-plugin-secret
