apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq-connector
  namespace: openfaas
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbitmq-connector
  template:
    metadata:
      labels:
        app: rabbitmq-connector
    spec:
      containers:
      - name: connector
        image: templum/rabbitmq-connector:develop
        imagePullPolicy: Always
        env:
        - name: basic_auth
          value: "true"
        - name: secret_mount_path
          value: "/etc/openfaas"
        - name: OPEN_FAAS_GW_URL
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: OPEN_FAAS_GW_URL
        - name: RMQ_TOPICS
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: RMQ_TOPICS
        - name: RMQ_HOST
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: RMQ_HOST
        - name: RMQ_PORT
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: RMQ_PORT
        - name: RMQ_USER
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: RMQ_USER
        - name: RMQ_PASS
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: RMQ_PASS
        - name: REQ_TIMEOUT
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: REQ_TIMEOUT
        - name: TOPIC_MAP_REFRESH_TIME
          valueFrom:
            configMapKeyRef:
              name: rabbitmq-connector-configmap
              key: TOPIC_MAP_REFRESH_TIME
        - name: PATH_TO_TOPOLOGY
          value: "/var/topology/topology.yaml"
        - name: TLS_ENABLED
          value: "true"
        - name: TLS_CA_CERT_PATH
          value: "/var/ca-cert/cert.pem"
        - name: TLS_SERVER_CERT_PATH
          value: "/var/server-tls/cert.crt"
        - name: TLS_SERVER_KEY_PATH
          value: "/var/server-tls/key.key"
        resources: # Adjust them to suite your needs
          requests:
            cpu: 250m
            memory: .25Gi
          limits:
            cpu: 250m
            memory: .25Gi
        volumeMounts:
          - name: basic-auth
            readOnly: true
            mountPath: "/etc/openfaas"
          - name: topology
            readOnly: true
            mountPath: "/var/topology"
          - name: ca-cert
            readOnly: true
            mountPath: "/var/ca-cert"
          - name: server-tls
            readOnly: true
            mountPath: "/var/server-tls"
      volumes:
        - name: basic-auth
          secret:
            secretName: basic-auth
        - name: topology
          configMap:
            name: topology
        - name: ca-cert
          secret:
            secretName: ca-cert
        - name: server-tls
          secret:
            secretName: server-tls
