mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Use the container whose limit is hit for system OOMs
This commit is contained in:
parent
0ad60b35c1
commit
fc6b4719fd
@ -72,7 +72,7 @@ func (ow *realWatcher) Start(ref *v1.ObjectReference) error {
|
||||
defer runtime.HandleCrash()
|
||||
|
||||
for event := range outStream {
|
||||
if event.ContainerName == recordEventContainerName {
|
||||
if event.VictimContainerName == recordEventContainerName {
|
||||
klog.V(1).Infof("Got sys oom event: %v", event)
|
||||
eventMsg := "System OOM encountered"
|
||||
if event.ProcessName != "" && event.Pid != 0 {
|
||||
|
@ -57,8 +57,8 @@ func TestWatcherRecordsEventsForOomEvents(t *testing.T) {
|
||||
Pid: 1000,
|
||||
ProcessName: "fakeProcess",
|
||||
TimeOfDeath: time.Now(),
|
||||
ContainerName: recordEventContainerName,
|
||||
VictimContainerName: "some-container",
|
||||
ContainerName: recordEventContainerName + "some-container",
|
||||
VictimContainerName: recordEventContainerName,
|
||||
},
|
||||
}
|
||||
numExpectedOomEvents := len(oomInstancesToStream)
|
||||
@ -109,15 +109,15 @@ func TestWatcherRecordsEventsForOomEventsCorrectContainerName(t *testing.T) {
|
||||
Pid: 1000,
|
||||
ProcessName: "fakeProcess",
|
||||
TimeOfDeath: time.Now(),
|
||||
ContainerName: recordEventContainerName,
|
||||
VictimContainerName: "some-container",
|
||||
ContainerName: recordEventContainerName + "some-container",
|
||||
VictimContainerName: recordEventContainerName,
|
||||
},
|
||||
{
|
||||
Pid: 1000,
|
||||
ProcessName: "fakeProcess",
|
||||
TimeOfDeath: time.Now(),
|
||||
ContainerName: "/dont-record-oom-event",
|
||||
VictimContainerName: "some-container",
|
||||
ContainerName: recordEventContainerName + "kubepods/some-container",
|
||||
VictimContainerName: recordEventContainerName + "kubepods",
|
||||
},
|
||||
}
|
||||
numExpectedOomEvents := len(oomInstancesToStream) - numOomEventsWithIncorrectContainerName
|
||||
@ -151,8 +151,8 @@ func TestWatcherRecordsEventsForOomEventsWithAdditionalInfo(t *testing.T) {
|
||||
Pid: eventPid,
|
||||
ProcessName: processName,
|
||||
TimeOfDeath: time.Now(),
|
||||
ContainerName: recordEventContainerName,
|
||||
VictimContainerName: "some-container",
|
||||
ContainerName: recordEventContainerName + "some-container",
|
||||
VictimContainerName: recordEventContainerName,
|
||||
},
|
||||
}
|
||||
numExpectedOomEvents := len(oomInstancesToStream)
|
||||
|
Loading…
Reference in New Issue
Block a user