feat(multiplayer): wire allocator metrics discovery

This commit is contained in:
Josh Creek
2026-09-01 18:46:31 +01:00
parent 9a72dd5eab
commit 95e82cc719
5 changed files with 50 additions and 1 deletions
+13
View File
@@ -17,6 +17,8 @@ def verify(directory: Path, service_path: Path) -> None:
monitor = (directory / "prometheus-service-monitor.yaml").read_text()
rules = (directory / "prometheus-rules.yaml").read_text()
service = service_path.read_text()
allocator_monitor = (directory / "prometheus-allocator-service-monitor.yaml").read_text()
allocator_service = (ROOT / "deploy/k8s/base/allocator-service.yaml").read_text()
if "kind: ServiceMonitor" not in monitor:
raise ValueError("ServiceMonitor resource is missing")
@@ -33,6 +35,17 @@ def verify(directory: Path, service_path: Path) -> None:
if "interval: 15s" not in monitor or "scrapeTimeout: 5s" not in monitor:
raise ValueError("ServiceMonitor interval/timeout contract changed")
if "kind: ServiceMonitor" not in allocator_monitor or "name: allocator" not in allocator_monitor:
raise ValueError("allocator ServiceMonitor is missing")
if not re.search(r"(?m)^ - port: metrics$", allocator_monitor) or not re.search(r"(?m)^ path: /metrics$", allocator_monitor):
raise ValueError("allocator ServiceMonitor endpoint is invalid")
if "namespace: cosmic-clash" not in allocator_monitor or " - cosmic-clash" not in allocator_monitor:
raise ValueError("allocator ServiceMonitor namespace is not restricted")
if "kind: Service" not in allocator_service or "name: allocator" not in allocator_service:
raise ValueError("allocator metrics Service is missing")
if "name: metrics" not in allocator_service or "port: 9091" not in allocator_service:
raise ValueError("allocator metrics Service port is missing")
if "kind: Service" not in service or "name: control-plane" not in service:
raise ValueError("control-plane Service is missing")
if not re.search(r"(?m)^ - name: http$", service):