From ff4aaf7c328a58fcad8e4fb0f93ea543725eedd5 Mon Sep 17 00:00:00 2001 From: Akhil Rane Date: Wed, 20 Dec 2023 04:57:17 -0800 Subject: [PATCH] feat: add last termination state when pod is in CrashloopBackoff (#792) Signed-off-by: Akhil Rane Co-authored-by: Akhil Rane --- pkg/analyzer/pod.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/analyzer/pod.go b/pkg/analyzer/pod.go index 3920767..667da6e 100644 --- a/pkg/analyzer/pod.go +++ b/pkg/analyzer/pod.go @@ -84,6 +84,14 @@ func (PodAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) { }) } } + + // This represents container that is in CrashLoopBackOff state due to conditions such as OOMKilled + if containerStatus.State.Waiting.Reason == "CrashLoopBackOff" { + failures = append(failures, common.Failure{ + Text: fmt.Sprintf("the last termination reason is %s container=%s pod=%s", containerStatus.LastTerminationState.Terminated.Reason, containerStatus.Name, pod.Name), + Sensitive: []common.Sensitive{}, + }) + } } else { // when pod is Running but its ReadinessProbe fails if !containerStatus.Ready && pod.Status.Phase == "Running" {