apiVersion: apps/v1
kind: Deployment
metadata:
  name: pi-mqtt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pi-mqtt
  template:
    metadata:
      labels:
        app: pi-mqtt
    spec:

      volumes:
        - name: nginx-conf
          configMap:
            name: pi-mqtt-nginx-conf
      containers:
        - name: proxy
          image: docker.io/nginx:1.21.6
          ports:
            - containerPort: 80
          volumeMounts:
            - { name: nginx-conf, mountPath: "/etc/nginx/" }
          livenessProbe:
            httpGet:
              path: /health
              port: 80
        - name: pi-mqtt-vite
          image: reg:5000/pi_mqtt_image
          ports:
            - containerPort: 8002
          command:
            - pnpm
            - exec
            - vite
            - --port=8002
        - name: pi-mqtt-py
          image: reg:5000/pi_mqtt_image
          ports:
            - containerPort: 8001
          command:
          - pdm
          - run
          - uvicorn
          - '--port=8001'
          - '--host=0.0.0.0'
          - '--reload'
          - 'pi_mqtt:app'
---
apiVersion: v1
kind: Service
metadata:
  name: pi-mqtt
spec:
  ports:
  - {port: 80, targetPort: 80}
  selector:
    app: pi-mqtt
