From 372bf95a4f208473aed21b4142b1d673aade0d0c Mon Sep 17 00:00:00 2001 From: ianlang Date: Sun, 27 Oct 2019 23:27:00 +0800 Subject: [PATCH] reject pods when under disk pressure --- pkg/kubelet/eviction/eviction_manager.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/eviction/eviction_manager.go b/pkg/kubelet/eviction/eviction_manager.go index 1e3fce78e17..dd79d809e01 100644 --- a/pkg/kubelet/eviction/eviction_manager.go +++ b/pkg/kubelet/eviction/eviction_manager.go @@ -137,8 +137,10 @@ func (m *managerImpl) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd if kubelettypes.IsCriticalPod(attrs.Pod) { return lifecycle.PodAdmitResult{Admit: true} } - // the node has memory pressure, admit if not best-effort - if hasNodeCondition(m.nodeConditions, v1.NodeMemoryPressure) { + + // Conditions other than memory pressure reject all pods + nodeOnlyHasMemoryPressureCondition := hasNodeCondition(m.nodeConditions, v1.NodeMemoryPressure) && len(m.nodeConditions) == 1 + if nodeOnlyHasMemoryPressureCondition { notBestEffort := v1.PodQOSBestEffort != v1qos.GetPodQOS(attrs.Pod) if notBestEffort { return lifecycle.PodAdmitResult{Admit: true}