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:
co-authored by
Claude Opus 5.5
parent
4a63f57674
commit
58c4ffe804
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user