v0.11.3: one FailedMount of a ready pod is information

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Виталий Чефанов
2026-09-28 16:46:05 +03:00
co-authored by Claude Opus 5.5
parent 4a63f57674
commit 58c4ffe804
3 changed files with 34 additions and 4 deletions
+3
View File
@@ -1,3 +1,6 @@
v0.11.3:
fixes:
- "A single FailedMount of a pod that is running and ready (kubelet failing to refresh a volume, such as a ConfigMap prometheus-operator deletes and recreates) is listed for information; it badges the card after five repeats in the window, like other events."
v0.11.2:
fixes:
- "Warning events of a pod that has since finished, and FailedScheduling of a pod that has since been scheduled, are listed for information and no longer badge the card: a backup CronJob that waited all night for its node and then ran stayed yellow for half an hour."
@@ -178,7 +178,7 @@ func attachProblems(g *Graph, in problemInputs) {
for _, n := range in.nodes {
nodeProblems(s, n)
}
eventProblems(s, in.events, podOwner, podsLive(in.pods), podsScheduled(in.pods))
eventProblems(s, in.events, podOwner, podsLive(in.pods), podsScheduled(in.pods), podsReady(in.pods))
for _, n := range g.Nodes {
if !syntheticProbe(n.Namespace, n.Label) {
readinessProblem(s, n, notReadySince)
@@ -396,7 +396,7 @@ func eventsInWindow(e corev1.Event, last time.Time) int {
// eventProblems folds recent Warning events into one problem per card and
// reason, keeping the latest message.
func eventProblems(s *problemSet, events []corev1.Event, podOwner map[string]string, live, scheduled map[string]bool) {
func eventProblems(s *problemSet, events []corev1.Event, podOwner map[string]string, live, scheduled, ready map[string]bool) {
type key struct{ id, reason string }
folded := map[key]*Problem{}
var order []key
@@ -420,11 +420,16 @@ func eventProblems(s *problemSet, events []corev1.Event, podOwner map[string]str
}
for _, k := range order {
p := folded[k]
if eventBenign[p.Reason] || (!eventNotable[p.Reason] && p.Count < eventRepeats) {
pod := namespaceOfID(k.id) + "/" + p.Object
// A pod that is running and ready already has its volumes: a
// FailedMount then is kubelet failing to refresh one, e.g. a
// ConfigMap prometheus-operator deletes and recreates. Once is
// noise; it has to repeat like any other event.
notable := eventNotable[p.Reason] && (p.Reason != "FailedMount" || !ready[pod])
if eventBenign[p.Reason] || (!notable && p.Count < eventRepeats) {
p.Severity = Info
}
// the pod the latest event was about is gone: history, not state
pod := namespaceOfID(k.id) + "/" + p.Object
if p.Object != "" && !live[pod] {
p.Severity = Info
}
@@ -488,6 +493,18 @@ func podsLive(pods []corev1.Pod) map[string]bool {
return out
}
func podsReady(pods []corev1.Pod) map[string]bool {
out := make(map[string]bool, len(pods))
for _, p := range pods {
for _, c := range p.Status.Conditions {
if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue {
out[p.Namespace+"/"+p.Name] = true
}
}
}
return out
}
func podsScheduled(pods []corev1.Pod) map[string]bool {
out := make(map[string]bool, len(pods))
for _, p := range pods {
@@ -204,6 +204,16 @@ func TestRedirectIngressAndGonePods(t *testing.T) {
if problemsOf(g, "wl/shop/deployment/web")["FailedMount"].Severity != Warning {
t.Error("event of a live pod must badge")
}
// the same pod once it is ready: a single FailedMount is a volume refresh
g2 := &Graph{Nodes: []Node{{ID: "ns/shop"}, {ID: "wl/shop/deployment/web"}}}
attachProblems(g2, problemInputs{
pods: []corev1.Pod{{ObjectMeta: metav1.ObjectMeta{Name: "web-5f-live", Namespace: "shop", OwnerReferences: owned("ReplicaSet", "web-5f")},
Status: corev1.PodStatus{Phase: corev1.PodRunning, Conditions: []corev1.PodCondition{{Type: corev1.PodReady, Status: corev1.ConditionTrue}}}}},
events: []corev1.Event{{Type: corev1.EventTypeWarning, Reason: "FailedMount", LastTimestamp: metav1.NewTime(t0), InvolvedObject: corev1.ObjectReference{Kind: "Pod", Namespace: "shop", Name: "web-5f-live"}}},
})
if p := problemsOf(g2, "wl/shop/deployment/web")["FailedMount"]; p.Severity != Info {
t.Errorf("one FailedMount of a ready pod must be information: %+v", p)
}
if p := problemsOf(g, "ns/shop")["Failed"]; p.Severity != Info {
t.Errorf("event of a deleted pod must be information: %+v", p)
}