apiVersion: v1
kind: Pod
metadata:
  name: vmq-siot
  labels:
    daemon: "vmq-siot"
spec:
  containers:
  - name: vmq
    image: michaelfung/vmq:1.4.1-siot-2
    env:
    - name: VMQ_SAMPLE_ENV
      value: example
    # use RAM only for QoS
    - name: VMQ_USE_RAM
      value: "yes"
    ports:
    - containerPort: 8883
      name: mqtt-things
    - containerPort: 8887
      name: mqtt-users
    - containerPort: 8888
      name: vmq-metrics
    volumeMounts:
    - mountPath: /opt/vernemq/data
      name: data
    - mountPath: /opt/vernemq/log
      name: log
    - mountPath: /opt/vernemq/etc
      name: config
    - mountPath: /opt/vernemq/tls
      readOnly: true
      name: tls
    readinessProbe:
      tcpSocket:
        port: mqtt-things
      initialDelaySeconds: 10
      periodSeconds: 10
    livenessProbe:
      tcpSocket:
        port: mqtt-things
      initialDelaySeconds: 30
      periodSeconds: 30

  volumes:
    - name: data
      emptyDir: {}
    - name: log
      emptyDir: {}
    - name: config
      configMap:
        name: vmq-siot-config
        items:
        - key: vernemq-siot.conf
          path: vernemq.conf
        - key: vmq.acl
          path: vmq.acl
    - name: tls
      secret:
        # file mode 440 (288 in decimal)
        # defaultMode: 288  # not used because already mount Readonly
        secretName: "vmq-tls"
