diff --git a/internal/monitoring/guest_config_conversion_coverage_test.go b/internal/monitoring/guest_config_conversion_coverage_test.go index 317319149..f33421312 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 f3acb62c7..d7263b362 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". } }