apiVersion: apps/v1
kind: Deployment
metadata:
  name: zigbee2mqtt
  labels:
    app.kubernetes.io/name: zigbee2mqtt
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: zigbee2mqtt
  template:
    metadata:
      labels:
        app.kubernetes.io/name: zigbee2mqtt
    spec:
      containers:
        - name: zigbee2mqtt
          image: koenkk/zigbee2mqtt:1.21.0
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 50m
              memory: 100Mi
            limits:
              smarter-devices/ttyUSB0: 1
          ports:
            - name: z2mqtt-port
              protocol: TCP
              containerPort: 8080
          volumeMounts:
            - name: zigbee2mqtt-config
              mountPath: /config
          startupProbe:
            tcpSocket:
              port: z2mqtt-port
            initialDelaySeconds: 0
            timeoutSeconds: 1
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 30
          livenessProbe:
            tcpSocket:
              port: z2mqtt-port
            initialDelaySeconds: 0
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            tcpSocket:
              port: z2mqtt-port
            initialDelaySeconds: 0
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          env:
            - name: ZIGBEE2MQTT_DATA
              value: "/config"
            - name: TZ
              value: ${CONFIG_TIMEZONE}
      volumes:
        - name: zigbee2mqtt-config
          persistentVolumeClaim:
            claimName: zigbee2mqtt-config
