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

      volumes:
        - name: nginx-conf
          configMap:
            name: mqtt-metrics-nginx-conf
      containers:
        - name: proxy
          image: docker.io/nginx:1.21.6
          ports:
            - containerPort: 80
          volumeMounts:
            - { name: nginx-conf, mountPath: "/etc/nginx/" }
        - name: mqtt-metrics-vite
          image: reg:5000/mqtt_metrics_image
          ports:
            - containerPort: 8002
          command:
            - pnpm
            - exec
            - vite
            - --port=8002
        - name: mqtt-metrics-py
          image: reg:5000/mqtt_metrics_image
          ports:
            - containerPort: 8001
          command:
          - pdm
          - run
          - python
          - 'mqtt_metrics.py'
---
apiVersion: v1
kind: Service
metadata:
  name: mqtt-metrics
spec:
  ports:
  - {port: 80, targetPort: 80}
  selector:
    app: mqtt-metrics
