Skip to content

Commit 0b80c43

Browse files
committed
Set the oom_score_adj of guaranteed pod to -997
When oom happens, the sandbox maybe killed first, so set the oom score of guaranteed pod to -997.
1 parent 3a50184 commit 0b80c43

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/kubelet/qos/policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
KubeletOOMScoreAdj int = -999
3232
DockerOOMScoreAdj int = -999
3333
KubeProxyOOMScoreAdj int = -999
34-
guaranteedOOMScoreAdj int = -998
34+
guaranteedOOMScoreAdj int = -997
3535
besteffortOOMScoreAdj int = 1000
3636
)
3737

pkg/kubelet/qos/policy_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ func TestGetContainerOOMScoreAdjust(t *testing.T) {
187187
{
188188
pod: &equalRequestLimitCPUMemory,
189189
memoryCapacity: 123456789,
190-
lowOOMScoreAdj: -998,
191-
highOOMScoreAdj: -998,
190+
lowOOMScoreAdj: -997,
191+
highOOMScoreAdj: -997,
192192
},
193193
{
194194
pod: &cpuUnlimitedMemoryLimitedWithRequests,
@@ -199,14 +199,14 @@ func TestGetContainerOOMScoreAdjust(t *testing.T) {
199199
{
200200
pod: &requestNoLimit,
201201
memoryCapacity: standardMemoryAmount,
202-
lowOOMScoreAdj: 2,
203-
highOOMScoreAdj: 2,
202+
lowOOMScoreAdj: 3,
203+
highOOMScoreAdj: 3,
204204
},
205205
{
206206
pod: &critical,
207207
memoryCapacity: 4000000000,
208-
lowOOMScoreAdj: -998,
209-
highOOMScoreAdj: -998,
208+
lowOOMScoreAdj: -997,
209+
highOOMScoreAdj: -997,
210210
},
211211
}
212212
for _, test := range oomTests {

0 commit comments

Comments
 (0)