From 0b80c43f768c92c80b74c046b97da3f044b379d3 Mon Sep 17 00:00:00 2001 From: DeliangFan Date: Tue, 20 Nov 2018 22:08:05 +0800 Subject: [PATCH] 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. --- pkg/kubelet/qos/policy.go | 2 +- pkg/kubelet/qos/policy_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/kubelet/qos/policy.go b/pkg/kubelet/qos/policy.go index 344b0d99ce9..59052f19853 100644 --- a/pkg/kubelet/qos/policy.go +++ b/pkg/kubelet/qos/policy.go @@ -31,7 +31,7 @@ const ( KubeletOOMScoreAdj int = -999 DockerOOMScoreAdj int = -999 KubeProxyOOMScoreAdj int = -999 - guaranteedOOMScoreAdj int = -998 + guaranteedOOMScoreAdj int = -997 besteffortOOMScoreAdj int = 1000 ) diff --git a/pkg/kubelet/qos/policy_test.go b/pkg/kubelet/qos/policy_test.go index deebc439783..19b2f912b4f 100644 --- a/pkg/kubelet/qos/policy_test.go +++ b/pkg/kubelet/qos/policy_test.go @@ -187,8 +187,8 @@ func TestGetContainerOOMScoreAdjust(t *testing.T) { { pod: &equalRequestLimitCPUMemory, memoryCapacity: 123456789, - lowOOMScoreAdj: -998, - highOOMScoreAdj: -998, + lowOOMScoreAdj: -997, + highOOMScoreAdj: -997, }, { pod: &cpuUnlimitedMemoryLimitedWithRequests, @@ -199,14 +199,14 @@ func TestGetContainerOOMScoreAdjust(t *testing.T) { { pod: &requestNoLimit, memoryCapacity: standardMemoryAmount, - lowOOMScoreAdj: 2, - highOOMScoreAdj: 2, + lowOOMScoreAdj: 3, + highOOMScoreAdj: 3, }, { pod: &critical, memoryCapacity: 4000000000, - lowOOMScoreAdj: -998, - highOOMScoreAdj: -998, + lowOOMScoreAdj: -997, + highOOMScoreAdj: -997, }, } for _, test := range oomTests {