Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

monitoring: surface CrashLoopBackOff pods as degraded on the frontend

rcourtmana191f2ab2b41
diff --git a/internal/monitoring/guest_config_conversion_coverage_test.go b/internal/monitoring/guest_config_conversion_coverage_test.go
index 3173191497..f334213129 100644
--- a/internal/monitoring/guest_config_conversion_coverage_test.go
+++ b/internal/monitoring/guest_config_conversion_coverage_test.go
@@ -437,6 +437,29 @@ func TestMonitorFrontendAndMetricHelpers(t *testing.T) {
},
want: "stopped",
},
+ {
+ // CrashLoopBackOff: phase stays "Running" but containers are
+ // unready, so statusFromKubernetesPod returns StatusWarning.
+ // The frontend mapping must surface that as "degraded" rather
+ // than reporting the pod as healthy on the strength of phase
+ // alone.
+ name: "pod warning running degraded",
+ resourceType: "pod",
+ resource: unifiedresources.Resource{
+ Status: unifiedresources.StatusWarning,
+ Kubernetes: &unifiedresources.K8sData{PodPhase: "running"},
+ },
+ want: "degraded",
+ },
+ {
+ name: "pod online running running",
+ resourceType: "pod",
+ resource: unifiedresources.Resource{
+ Status: unifiedresources.StatusOnline,
+ Kubernetes: &unifiedresources.K8sData{PodPhase: "running"},
+ },
+ want: "running",
+ },
{
name: "workload online running fallback",
resourceType: "system-container",
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index f3acb62c7f..d7263b362c 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -5667,13 +5667,15 @@ func monitorFrontendStatus(resource unifiedresources.Resource, resourceType stri
if resource.Kubernetes != nil {
phase := strings.ToLower(strings.TrimSpace(resource.Kubernetes.PodPhase))
switch phase {
- case "running":
- return "running"
case "pending", "unknown":
return "degraded"
case "succeeded", "failed":
return "stopped"
}
+ // Phase=Running is not enough — a pod can have Phase=Running with
+ // CrashLoopBackOff containers, which statusFromKubernetesPod
+ // correctly classifies as StatusWarning. Fall through to the
+ // unified-status mapping below so that surfaces as "degraded".
}
}