apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-config
  namespace: mvp-cc
data:
  prometheus.yml: |
    global:
      scrape_interval: 15s
    scrape_configs:
      - job_name: 'mvp-services'
        metrics_path: /health
        static_configs:
          - targets:
              - auth-service:8000
              - audit-service:8000
              - customer-service:8000
              - interaction-service:8000
              - routing-service:8000
              - voice-adapter-service:8000
              - telegram-adapter-service:8000
              - kb-service:8000
              - reporting-service:8000
              - supervisor-service:8000
              - api-gateway:8000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus
  namespace: mvp-cc
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      containers:
      - name: prometheus
        image: prom/prometheus:v2.55.1
        args:
          - --config.file=/etc/prometheus/prometheus.yml
        volumeMounts:
          - name: config
            mountPath: /etc/prometheus
      volumes:
        - name: config
          configMap:
            name: prometheus-config
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: mvp-cc
spec:
  selector:
    app: prometheus
  ports:
    - name: http
      port: 9090
      targetPort: 9090
  type: ClusterIP
