Skip to content

Commit bbd149b

Browse files
Merge pull request #22692 from smarterclayton/add_reason
Report the pod exit reason in the event monitor
2 parents 721155c + c99e93f commit bbd149b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/monitor/pod.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Inter
111111
conditions = append(conditions, Condition{
112112
Level: Error,
113113
Locator: locatePodContainer(pod, s.Name),
114-
Message: fmt.Sprintf("container exited with code %d: %s", t.ExitCode, t.Message),
114+
Message: fmt.Sprintf("container exited with code %d (%s): %s", t.ExitCode, t.Reason, t.Message),
115115
})
116116
}
117117
}
@@ -120,7 +120,7 @@ func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Inter
120120
conditions = append(conditions, Condition{
121121
Level: Error,
122122
Locator: locatePodContainer(pod, s.Name),
123-
Message: fmt.Sprintf("init container exited with code %d: %s", t.ExitCode, t.Message),
123+
Message: fmt.Sprintf("init container exited with code %d (%s): %s", t.ExitCode, t.Reason, t.Message),
124124
})
125125
}
126126
}
@@ -159,7 +159,7 @@ func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Inter
159159
conditions = append(conditions, Condition{
160160
Level: Error,
161161
Locator: locatePodContainer(pod, s.Name),
162-
Message: fmt.Sprintf("container exited with code %d: %s", t.ExitCode, t.Message),
162+
Message: fmt.Sprintf("container exited with code %d (%s): %s", t.ExitCode, t.Reason, t.Message),
163163
})
164164
}
165165
if s.RestartCount != previous.RestartCount {
@@ -187,7 +187,7 @@ func startPodMonitoring(ctx context.Context, m Recorder, client kubernetes.Inter
187187
conditions = append(conditions, Condition{
188188
Level: Error,
189189
Locator: locatePodContainer(pod, s.Name),
190-
Message: fmt.Sprintf("init container exited with code %d: %s", t.ExitCode, t.Message),
190+
Message: fmt.Sprintf("init container exited with code %d (%s): %s", t.ExitCode, t.Reason, t.Message),
191191
})
192192
}
193193
if s.RestartCount != previous.RestartCount {

0 commit comments

Comments
 (0)