change default oom victim container name #2160
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
background
In kubernetes, kubelet subscribes to cadvisor and follow the OOM event, the request is as below,
kubelet's related code is here, then cadvisor will return all system oom event against this request.
what happened to me
However, when I used this request as kubernetes with the only difference is the eventType, which is
EventOomKill
in mine, it seems not to work to me, I expect that cadvisor return all system oom kill event. (aside: The difference ofEventOomKill
andEventOom
is described here).cadvisor's behavior
When some process indeed been killed because of oom, cadvisor check if event satisfies request. In a situation described as above, cadvisor checks satisfaction and invokes
checkIfIsSubcontainer
, butcheckIfIsSubcontainer
always fails, which shouldn't happen.this PR fixes this bug by initializing
OomInstance.VictimContainerName
as '/', which is the same as whatOomInstance.ContainerName
does. when oom parser parses kmsg's log and doesn't find a killed container, it will stay this name. and then if someone request as above, it will match this oom kill event and return this event.