Use the container whose limit is hit for system OOMs

This commit is contained in:
David Ashpole 2020-03-05 11:04:02 -08:00
parent 0ad60b35c1
commit fc6b4719fd
2 changed files with 9 additions and 9 deletions

View File

@ -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 {

View File

@ -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)