mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +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()
|
defer runtime.HandleCrash()
|
||||||
|
|
||||||
for event := range outStream {
|
for event := range outStream {
|
||||||
if event.ContainerName == recordEventContainerName {
|
if event.VictimContainerName == recordEventContainerName {
|
||||||
klog.V(1).Infof("Got sys oom event: %v", event)
|
klog.V(1).Infof("Got sys oom event: %v", event)
|
||||||
eventMsg := "System OOM encountered"
|
eventMsg := "System OOM encountered"
|
||||||
if event.ProcessName != "" && event.Pid != 0 {
|
if event.ProcessName != "" && event.Pid != 0 {
|
||||||
|
@ -57,8 +57,8 @@ func TestWatcherRecordsEventsForOomEvents(t *testing.T) {
|
|||||||
Pid: 1000,
|
Pid: 1000,
|
||||||
ProcessName: "fakeProcess",
|
ProcessName: "fakeProcess",
|
||||||
TimeOfDeath: time.Now(),
|
TimeOfDeath: time.Now(),
|
||||||
ContainerName: recordEventContainerName,
|
ContainerName: recordEventContainerName + "some-container",
|
||||||
VictimContainerName: "some-container",
|
VictimContainerName: recordEventContainerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
numExpectedOomEvents := len(oomInstancesToStream)
|
numExpectedOomEvents := len(oomInstancesToStream)
|
||||||
@ -109,15 +109,15 @@ func TestWatcherRecordsEventsForOomEventsCorrectContainerName(t *testing.T) {
|
|||||||
Pid: 1000,
|
Pid: 1000,
|
||||||
ProcessName: "fakeProcess",
|
ProcessName: "fakeProcess",
|
||||||
TimeOfDeath: time.Now(),
|
TimeOfDeath: time.Now(),
|
||||||
ContainerName: recordEventContainerName,
|
ContainerName: recordEventContainerName + "some-container",
|
||||||
VictimContainerName: "some-container",
|
VictimContainerName: recordEventContainerName,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Pid: 1000,
|
Pid: 1000,
|
||||||
ProcessName: "fakeProcess",
|
ProcessName: "fakeProcess",
|
||||||
TimeOfDeath: time.Now(),
|
TimeOfDeath: time.Now(),
|
||||||
ContainerName: "/dont-record-oom-event",
|
ContainerName: recordEventContainerName + "kubepods/some-container",
|
||||||
VictimContainerName: "some-container",
|
VictimContainerName: recordEventContainerName + "kubepods",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
numExpectedOomEvents := len(oomInstancesToStream) - numOomEventsWithIncorrectContainerName
|
numExpectedOomEvents := len(oomInstancesToStream) - numOomEventsWithIncorrectContainerName
|
||||||
@ -151,8 +151,8 @@ func TestWatcherRecordsEventsForOomEventsWithAdditionalInfo(t *testing.T) {
|
|||||||
Pid: eventPid,
|
Pid: eventPid,
|
||||||
ProcessName: processName,
|
ProcessName: processName,
|
||||||
TimeOfDeath: time.Now(),
|
TimeOfDeath: time.Now(),
|
||||||
ContainerName: recordEventContainerName,
|
ContainerName: recordEventContainerName + "some-container",
|
||||||
VictimContainerName: "some-container",
|
VictimContainerName: recordEventContainerName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
numExpectedOomEvents := len(oomInstancesToStream)
|
numExpectedOomEvents := len(oomInstancesToStream)
|
||||||
|
Loading…
Reference in New Issue
Block a user