apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: bigclown-gateway
  labels:
    k8s-app: bigclown-gateway
spec:
  selector:
    matchLabels:
      name: bigclown-gateway
  template:
    metadata:
      labels:
        name: bigclown-gateway
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: usb
                    operator: In
                    values:
                      - bigclown-dongle
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: bigclown-gateway
        image: mixi/bcg:latest
        imagePullPolicy: Always
        env:
        - name: MQTT_HOST
          value: "mosquitto"
        - name: MQTT_PORT
          value: "1883"
        - name: PARAMS
          value: "--debug"
        resources:
          limits:
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - name: vol-tmp
          mountPath: /tmp
        - name: vol-dev-usb0
          mountPath: /dev/ttyUSB0
        #- name: vol-dev
          #mountPath: /dev/
        securityContext:
          privileged: true
      terminationGracePeriodSeconds: 10
      volumes:
      - name: vol-tmp
        emptyDir: {}
      - name: vol-dev-usb0
        hostPath:
          path: /dev/ttyUSB0
      #- name: vol-dev
        #hostPath:
          #path: /dev/
