---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dmc-publisher-service
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dmc-publisher-service
  template:
    metadata:
      labels:
        app: dmc-publisher-service
        version: v1
    spec:
      volumes:
      - name: google-cloud-key
        secret:
          secretName: dmc-service-creds
      containers:
        - name: dmc-service
          image: dmc
          args: ["multicast", "publish", "-p", "$(PROJECT_ID)", "-t", "$(TOPIC_NAME)", "-a", "$(ADDRESS)", "-i", "$(IF_NAME)", "-r", "$(READ_BUFFER_BYTES)", "-v=$(VERBOSE)"]
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 50000
          volumeMounts:
          - name: google-cloud-key
            mountPath: /var/secrets/google
          env:
          - name: GOOGLE_APPLICATION_CREDENTIALS
            value: /var/secrets/google/key.json
          - name: PROJECT_ID
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: PROJECT_ID
          - name: TOPIC_NAME
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: TOPIC_NAME
          - name: ADDRESS
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: ADDRESS
          - name: IF_NAME
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: IF_NAME
          - name: READ_BUFFER_BYTES
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: READ_BUFFER_BYTES
          - name: VERBOSE
            valueFrom:
              configMapKeyRef:
                name: dmc-publisher-env-config
                key: VERBOSE
