Change:
<!-- STOP -- PLEASE READ! GitHub is not the right place for support requests. If you're looking for help, check and the . You can also post your question on the or the forum. If the matter is security related, please disclose it privately via --In the code below, kubelet rejects pods with QOS type guaranteed when under disk pressure, but when kubelet is also under memory pressure, those pods are accepted, is this behavior expected? Why is that?
/area kubelet /sig node
See this comment: It came with commit
you can find an answer from the proposal doc:
thank you ! I think current code is not following the eviction design of condition. the proposal is: but the code is: , guaranteed pods are not rejected any more. seems to be working fine though, maybe here's the reason: PS: above content can be found in

Discussion:
if kubelettypes.IsCriticalPod(attrs.Pod) { return lifecycle.PodAdmitResult{Admit: true} } <del> // the node has memory pressure, admit if not best-effort if hasNodeCondition(m.nodeConditions, v1.NodeMemoryPressure) { </del> <ins> // Conditions other than memory pressure reject all pods nodeOnlyHasMemoryPressureCondition := hasNodeCondition(m.nodeConditions, v1.NodeMemoryPressure) && len(m.nodeConditions) == 1 if nodeOnlyHasMemoryPressureCondition { </ins> notBestEffort := v1.PodQOSBestEffort != v1qos.GetPodQOS(attrs.Pod) if notBestEffort { return lifecycle.PodAdmitResult{Admit: true}

} } <ins> func makeContainersByQOS(class v1.PodQOSClass) []v1.Container { resource := newResourceList("100m", "1Gi", "") switch class { case v1.PodQOSGuaranteed: return []v1.Container{newContainer("guaranteed-container", resource, resource)} case v1.PodQOSBurstable: return []v1.Container{newContainer("burtable-container", resource, nil)} case v1.PodQOSBestEffort: fallthrough default: return []v1.Container{newContainer("best-effort-container", nil, nil)} } } func TestAdmitUnderNodeConditions(t *testing.T) { manager := &managerImpl{} pods := []*v1.Pod{ newPod("guaranteed-pod", scheduling.DefaultPriorityWhenNoDefaultClassExists, makeContainersByQOS(v1.PodQOSGuaranteed), nil), newPod("burstable-pod", scheduling.DefaultPriorityWhenNoDefaultClassExists, makeContainersByQOS(v1.PodQOSBurstable), nil), newPod("best-effort-pod", scheduling.DefaultPriorityWhenNoDefaultClassExists, makeContainersByQOS(v1.PodQOSBestEffort), nil), } expected := []bool{true, true, true} for i, pod := range pods { if result := manager.Admit(&lifecycle.PodAdmitAttributes{Pod: pod}); expected[i] != result.Admit { t.Errorf("Admit pod: %v, expected: %v, actual: %v", pod, expected[i], result.Admit) } } manager.nodeConditions = []v1.NodeConditionType{v1.NodeMemoryPressure} expected = []bool{true, true, false} for i, pod := range pods { if result := manager.Admit(&lifecycle.PodAdmitAttributes{Pod: pod}); expected[i] != result.Admit { t.Errorf("Admit pod: %v, expected: %v, actual: %v", pod, expected[i], result.Admit) } } manager.nodeConditions = []v1.NodeConditionType{v1.NodeMemoryPressure, v1.NodeDiskPressure} expected = []bool{false, false, false} for i, pod := range pods { if result := manager.Admit(&lifecycle.PodAdmitAttributes{Pod: pod}); expected[i] != result.Admit { t.Errorf("Admit pod: %v, expected: %v, actual: %v", pod, expected[i], result.Admit) } } } </ins> // parseQuantity parses the specified value (if provided) otherwise returns 0 value func parseQuantity(value string) resource.Quantity { if len(value) == 0 {