mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-22 19:36:46 +00:00
The Kubernetes Deployments tab was rendering CPU / Memory / Disk as "—" for every row because `resourceFromKubernetesDeployment` never set the Resource.Metrics payload. Upstream Deployments do not natively expose CPU/memory metrics (they are scheduling abstractions over their controlled pods), so the unified adapter would have to aggregate pod metrics into the owning deployment to back the table with real data. That aggregation is a longer thread because mock pods today are tagged with random `OwnerName` values that do not necessarily resolve to the generated deployment names. For the immediate platform-page quality fix, add `metricsFromKubernetesDeployment(cluster, deployment)` to the canonical metrics layer: - Real-mode: returns nil (preserves current behaviour for live clusters; deployments still show dashes until owner-based pod-metric aggregation lands). - Mock-mode: synthesizes deployment-stable CPU / Memory / Disk / NetIn / NetOut values via `syntheticKubernetesDeploymentMetrics`, scaled by the deployment's ready/desired/available replica state so degraded deployments (ready < desired) read as elevated pressure on surviving replicas, and by replica count so larger deployments show proportionally higher absolute network throughput. `resourceFromKubernetesDeployment` now calls the helper inline. Live mock verification: `/api/resources?type=k8s-deployment` rows now carry populated `metrics.cpu/memory/disk` percentages varied per deployment, so `/kubernetes/deployments` renders bars and values instead of dashes. Tests: - `go test ./internal/unifiedresources/... ./internal/mock/... ./internal/monitoring/...` all green. - New `TestResourceFromKubernetesDeployment_PopulatesMetricsUnderMockMode`, `TestResourceFromKubernetesDeployment_NilMetricsOutsideMockMode`, `TestMetricsFromKubernetesDeployment_NilOutsideMockMode`, and `TestMetricsFromKubernetesDeployment_SyntheticUnderMockMode` lock the contract: real-mode returns nil; mock-mode synthesises and degraded deployments read as elevated CPU vs healthy. - Playwright (9/9) green against the live mock-mode dev runtime. Contract updated: `unified-resources.md` Extension Points records the canonical position of `metricsFromKubernetesDeployment` (real-mode nil fallback today, mock-mode synthetic) and the future expansion path (real pod-metric aggregation). |
||
|---|---|---|
| .. | ||
| internal | ||
| v6 | ||
| control_plane.json | ||
| control_plane.schema.json | ||