v0.8.3: a manual CronJob run is not a problem
Kubernetes emits UnexpectedJob for every Job of a CronJob it did not schedule itself; the backup job the site's maintenance starts by hand kept a warning on wordpress-backup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b01f884530
commit
c563cd3a2f
@@ -67,7 +67,11 @@ var (
|
||||
"FailedCreatePodSandBox": true, "BackOff": true, "Evicted": true, "OOMKilling": true, "FailedKillPod": true,
|
||||
"ProvisioningFailed": true, "FailedBinding": true, "NetworkNotReady": true, "SystemOOM": true,
|
||||
}
|
||||
eventRepeats = 5
|
||||
eventRepeats = 5
|
||||
// Warnings Kubernetes emits for normal operation. UnexpectedJob comes
|
||||
// from the CronJob controller for every Job of the CronJob it did not
|
||||
// schedule itself, i.e. every manual run (kubectl create job --from).
|
||||
eventBenign = map[string]bool{"UnexpectedJob": true}
|
||||
waitingCritical = map[string]bool{
|
||||
"CrashLoopBackOff": true, "ImagePullBackOff": true, "ErrImagePull": true, "InvalidImageName": true,
|
||||
"CreateContainerConfigError": true, "CreateContainerError": true, "RunContainerError": true,
|
||||
@@ -389,7 +393,7 @@ func eventProblems(s *problemSet, events []corev1.Event, podOwner map[string]str
|
||||
}
|
||||
for _, k := range order {
|
||||
p := folded[k]
|
||||
if !eventNotable[p.Reason] && p.Count < eventRepeats {
|
||||
if eventBenign[p.Reason] || (!eventNotable[p.Reason] && p.Count < eventRepeats) {
|
||||
p.Severity = Info
|
||||
}
|
||||
// the pod the latest event was about is gone: history, not state
|
||||
|
||||
@@ -182,8 +182,12 @@ func TestRedirectIngressAndGonePods(t *testing.T) {
|
||||
events: []corev1.Event{
|
||||
{Type: corev1.EventTypeWarning, Reason: "FailedMount", LastTimestamp: metav1.NewTime(t0), InvolvedObject: corev1.ObjectReference{Kind: "Pod", Namespace: "shop", Name: "web-5f-live"}},
|
||||
{Type: corev1.EventTypeWarning, Reason: "Failed", Count: 10, LastTimestamp: metav1.NewTime(t0), InvolvedObject: corev1.ObjectReference{Kind: "Pod", Namespace: "shop", Name: "verify-gone"}},
|
||||
{Type: corev1.EventTypeWarning, Reason: "UnexpectedJob", Count: 6, LastTimestamp: metav1.NewTime(t0), InvolvedObject: corev1.ObjectReference{Kind: "CronJob", Namespace: "shop", Name: "backup"}},
|
||||
},
|
||||
})
|
||||
if p := problemsOf(g, "ns/shop")["UnexpectedJob"]; p.Severity != Info {
|
||||
t.Errorf("a manual CronJob run is not a problem: %+v", p)
|
||||
}
|
||||
if len(problemsOf(g, "ingress/d8-monitoring/grafana-v10")) != 0 {
|
||||
t.Error("a redirecting Ingress reported for its unused backend")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user