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:
Виталий Чефанов
2026-09-24 18:31:23 +03:00
co-authored by Claude Opus 5.5
parent b01f884530
commit c563cd3a2f
4 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: cluster-map name: cluster-map
version: 0.8.2 version: 0.8.3
dependencies: dependencies:
- name: deckhouse_lib_helm - name: deckhouse_lib_helm
version: 1.72.24 version: 1.72.24
+3
View File
@@ -1,3 +1,6 @@
v0.8.3:
fixes:
- UnexpectedJob warnings (the CronJob controller's note on every manual run) are listed for information and no longer badge the CronJob.
v0.8.2: v0.8.2:
fixes: fixes:
- An Ingress that answers with a redirect (redirect annotations, or rewrite ... permanent / return 30x in a snippet) is not reported for a backend Service that does not exist; Deckhouse's prometheus Ingress does exactly that. - An Ingress that answers with a redirect (redirect annotations, or rewrite ... permanent / return 30x in a snippet) is not reported for a backend Service that does not exist; Deckhouse's prometheus Ingress does exactly that.
@@ -68,6 +68,10 @@ var (
"ProvisioningFailed": true, "FailedBinding": true, "NetworkNotReady": true, "SystemOOM": 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{ waitingCritical = map[string]bool{
"CrashLoopBackOff": true, "ImagePullBackOff": true, "ErrImagePull": true, "InvalidImageName": true, "CrashLoopBackOff": true, "ImagePullBackOff": true, "ErrImagePull": true, "InvalidImageName": true,
"CreateContainerConfigError": true, "CreateContainerError": true, "RunContainerError": 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 { for _, k := range order {
p := folded[k] p := folded[k]
if !eventNotable[p.Reason] && p.Count < eventRepeats { if eventBenign[p.Reason] || (!eventNotable[p.Reason] && p.Count < eventRepeats) {
p.Severity = Info p.Severity = Info
} }
// the pod the latest event was about is gone: history, not state // the pod the latest event was about is gone: history, not state
@@ -182,8 +182,12 @@ func TestRedirectIngressAndGonePods(t *testing.T) {
events: []corev1.Event{ 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: "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: "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 { if len(problemsOf(g, "ingress/d8-monitoring/grafana-v10")) != 0 {
t.Error("a redirecting Ingress reported for its unused backend") t.Error("a redirecting Ingress reported for its unused backend")
} }