diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 0947aa6aa3b..4d3daa8ebf9 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -2137,9 +2137,7 @@ func hasHostPortConflicts(pods []*api.Pod) bool { return false } -// hasInsufficientfFreeResources detects pods that exceeds node's resources. -// TODO: Consider integrate disk space into this function, and returns a -// suitable reason and message per resource type. +// hasInsufficientfFreeResources detects pods that exceeds node's cpu and memory resource. func (kl *Kubelet) hasInsufficientfFreeResources(pods []*api.Pod) (bool, bool) { info, err := kl.GetCachedMachineInfo() if err != nil { diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index e646eee37bb..db19091f22e 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -273,8 +273,8 @@ func CheckPodsExceedingFreeResources(pods []*api.Pod, allocatable api.ResourceLi memoryRequested := int64(0) for _, pod := range pods { podRequest := getResourceRequest(pod) - fitsCPU := totalMilliCPU == 0 || (totalMilliCPU-milliCPURequested) >= podRequest.milliCPU - fitsMemory := totalMemory == 0 || (totalMemory-memoryRequested) >= podRequest.memory + fitsCPU := (totalMilliCPU - milliCPURequested) >= podRequest.milliCPU + fitsMemory := (totalMemory - memoryRequested) >= podRequest.memory if !fitsCPU { // the pod doesn't fit due to CPU request notFittingCPU = append(notFittingCPU, pod)