apiVersion: apps/v1
kind: Deployment
metadata:
  name: mosquitto
  namespace: mosquitto
  labels:
    app: mosquitto
  annotations:
    secret.reloader.stakater.com/reload: "mosquitto-tls"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mosquitto
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mosquitto
    spec:
      containers:
        - name: mosquitto
          image: docker.io/eclipse-mosquitto:2.0.18-openssl
          imagePullPolicy: Always
          ports:
            - containerPort: 1883
              name: mqtt
              protocol: TCP
            - containerPort: 8883
              name: mqtts
              protocol: TCP
            - containerPort: 9002
              name: mqttwebsocket
              protocol: TCP
          volumeMounts:
            - mountPath: /mosquitto/config
              name: config
            - mountPath: /mosquitto/config.d
              name: config-secret
            - mountPath: /mosquitto/certificates
              name: certificates
            - mountPath: /mosquitto/acl
              name: acl
            - mountPath: /mosquitto/passwd
              name: passwd
            - mountPath: /mosquitto/data
              name: data
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 1
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 9002
            timeoutSeconds: 1
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 1
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 9002
            timeoutSeconds: 1
          resources: {}
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: mosquitto
        - name: config
          configMap:
            name: mosquitto
        - name: config-secret
          secret:
            secretName: config-secret
        - name: certificates
          secret:
            secretName: mosquitto-tls
        - name: acl
          secret:
            secretName: mosquitto-acl
        - name: passwd
          secret:
            secretName: mosquitto-passwd
