# ============================================================================
# ServiceMonitors for Prometheus to scrape Undateable services
# ============================================================================

---
# Auth Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: auth-service-monitor
  namespace: undateable
  labels:
    app: auth-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: auth-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# Profiles Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: profiles-service-monitor
  namespace: undateable
  labels:
    app: profiles-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: profiles-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# Messaging Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: messaging-service-monitor
  namespace: undateable
  labels:
    app: messaging-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: messaging-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# Burn Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: burn-service-monitor
  namespace: undateable
  labels:
    app: burn-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: burn-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# WebSocket Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: websocket-service-monitor
  namespace: undateable
  labels:
    app: websocket-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: websocket-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# Frontend Service Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: frontend-service-monitor
  namespace: undateable
  labels:
    app: frontend-service
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: frontend-service
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# BurnYourEx Frontend Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: burnyourex-frontend-monitor
  namespace: undateable
  labels:
    app: burnyourex-frontend
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: burnyourex-frontend
  namespaceSelector:
    matchNames:
      - undateable
  endpoints:
    - port: http
      path: /metrics
      interval: 30s
      scrapeTimeout: 10s
---
# NGINX Ingress Controller Monitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: nginx-ingress-monitor
  namespace: ingress-nginx
  labels:
    app: ingress-nginx
    release: prometheus
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: ingress-nginx
  namespaceSelector:
    matchNames:
      - ingress-nginx
  endpoints:
    - port: metrics
      path: /metrics
      interval: 30s
