Merge pull request #39306 from hex108/oom_score_adj

Automatic merge from submit-queue (batch tested with PRs 38084, 39306)

Small improve for GetContainerOOMScoreAdjust

In `GetContainerOOMScoreAdjust`, make logic more clear for the case `oomScoreAdjust >= besteffortOOMScoreAdj`. If `besteffortOOMScoreAdj`  is defined to another value(e.g. 996), suppose `oomScoreAdjust` is 999, the function will return 998(which equals 999 - 1) instead of 995(996 -1).
This commit is contained in:
Kubernetes Submit Queue 2017-01-04 07:18:07 -08:00 committed by GitHub
commit 2cc9650e7e

View File

@ -72,8 +72,8 @@ func GetContainerOOMScoreAdjust(pod *v1.Pod, container *v1.Container, memoryCapa
return (1000 + guaranteedOOMScoreAdj)
}
// Give burstable pods a higher chance of survival over besteffort pods.
if int(oomScoreAdjust) == besteffortOOMScoreAdj {
return int(oomScoreAdjust - 1)
if int(oomScoreAdjust) >= besteffortOOMScoreAdj {
return int(besteffortOOMScoreAdj - 1)
}
return int(oomScoreAdjust)
}