fix(doctor): surface container restart history, not just crash-loop-now (#1028 item 4)#231
Open
LukasWodka wants to merge 1 commit into
Open
fix(doctor): surface container restart history, not just crash-loop-now (#1028 item 4)#231LukasWodka wants to merge 1 commit into
LukasWodka wants to merge 1 commit into
Conversation
…ow (#1028) checkRestartHistory warns when any init/regular container RestartCount >= 3 — the current-state check missed pods that already crashed. Additive. Refs #1008.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
cluster doctorreported crash-loops from current pod state only, so it missed pods that had already restarted (crashed) earlier — backend#1028 (Item 4 of the prod-audit lows).Fix
checkRestartHistory— scans both init and regular container statuses across the tracebloc pods and warns when any container'sRestartCount >= 3, naming each offender + akubectl logs --previousremedy. Matches the existing doctor check/Result pattern.Test
TestCheckRestartHistory: no-restarts / below-threshold → OK; at/above-threshold → Warn; init-container restarts → Warn; crash-loop-now pod (RestartCount 0) → OK here (proves no overlap).go build/test/vet/gofmtclean.Refs backend#1008. (Items 1/2/3 — digest pin, OOM-orphan sweep, correlation id — tracked separately.)
🤖 Generated with Claude Code
Note
Low Risk
Read-only diagnostic addition with warn-only severity; existing pod crash-loop detection is unchanged.
Overview
tracebloc cluster doctornow includes a Restart history check so operators see containers that have flapped even when they are healthy right now.The existing Pod health check only treats active
CrashLoopBackOffas failure, so pods that restarted several times and recovered (or jobs that retried before succeeding) could still look fine. The new check lists pods in the namespace, scans init and app container statuses, and emits ⚠ when anyRestartCountis ≥ 3 (threshold chosen to avoid noise from 1–2 routine restarts). It names each pod/container and suggestskubectl logs … --previous; it does not replace or duplicate the crash-loop-now failure path.Tests cover threshold edge cases, init-container restarts, and that crash-looping pods stay this check’s responsibility vs Pod health; the integration test expects 9 checks instead of 8.
Reviewed by Cursor Bugbot for commit 7dc0eb3. Bugbot is set up for automated code reviews on this repo. Configure here.