apiVersion: apps/v1
kind: Deployment
metadata:
  name: zwavejs2mqtt
  namespace: home-assistant
  labels:
    app.kubernetes.io/name: zwavejs2mqtt
    app.kubernetes.io/instance: zwavejs2mqtt
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: zwavejs2mqtt
      app.kubernetes.io/instance: zwavejs2mqtt
  template:
    metadata:
      labels:
        app.kubernetes.io/name: zwavejs2mqtt
        app.kubernetes.io/instance: zwavejs2mqtt
    spec:
      nodeSelector:
        zwave: "true"
      containers:
        - name: zwavejs2mqtt
          image: zwavejs/zwavejs2mqtt:5.10.1
          livenessProbe:
            failureThreshold: 3
            httpGet:
              httpHeaders:
                - name: Accept
                  value: text/plain
              path: /health/zwave
              port: http
            initialDelaySeconds: 30
            periodSeconds: 60
            successThreshold: 1
            timeoutSeconds: 2
          ports:
            - containerPort: 8091
              name: http
              protocol: TCP
            - containerPort: 3000
              name: websocket
              protocol: TCP
          resources:
            requests:
              cpu: 50m
              memory: 100Mi
            limits:
              cpu: 1000m
              memory: 500Mi
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /dev/ttyACM0
              name: zwavestick
            - mountPath: /usr/src/app/store
              name: data
      volumes:
        - name: zwavestick
          hostPath:
            path: /dev/serial/by-id/usb-0658_0200-if00
        - name: data
          persistentVolumeClaim:
            claimName: zwavejs2mqtt
