kind: Deployment
apiVersion: apps/v1
metadata:
  name: zwave
spec:
  replicas: 1
  selector:
    matchLabels:
      name: zwave
  template:
    metadata:
      labels:
        name: zwave
      annotations:
        iam.amazonaws.com/role: IoTZwave
    spec:
      containers:
        - name: zwave
          image: chrisns/iot-zwave:latest
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 8091
            - name: telnet
              containerPort: 8888
          resources:
            limits:
              cpu: "1"
              memory: 512Mi
            requests:
              cpu: "1"
              memory: 400Mi
          volumeMounts:
            - mountPath: /dev/ttyUSB1
              name: zwavestick
            - mountPath: /usr/src/app/store
              name: data
            - mountPath: /usr/src/app/store/settings.json
              subPath: settings.json
              name: config
              readOnly: true
          # livenessProbe:
          #   httpGet:
          #     path: /health/zwave
          #     port: http
          #     httpHeaders:
          #       - name: Accept
          #         value: text/plain
          #   initialDelaySeconds: 30
          #   periodSeconds: 3
          #   failureThreshold: 10
          securityContext:
            allowPrivilegeEscalation: true
            privileged: true
          env:
            - name: DEVICE
              value: /dev/ttyUSB1
            - name: DEBUG
              value: ""
          envFrom:
            - secretRef:
                name: zwave
      restartPolicy: Always
      volumes:
        - name: zwavestick
          hostPath:
            path: /dev/ttyACM0
            type: File
        - name: data
          persistentVolumeClaim:
            claimName: zwave
