mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Merge pull request #15890 from lavalamp/fix-loud-log
NO BIG MESSAGES IN N^2 LOGGING
This commit is contained in:
commit
5449b0fda3
@ -144,6 +144,10 @@ func CheckPodsExceedingFreeResources(pods []*api.Pod, capacity api.ResourceList)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func podName(pod *api.Pod) string {
|
||||||
|
return pod.Namespace + "/" + pod.Name
|
||||||
|
}
|
||||||
|
|
||||||
// PodFitsResources calculates fit based on requested, rather than used resources
|
// PodFitsResources calculates fit based on requested, rather than used resources
|
||||||
func (r *ResourceFit) PodFitsResources(pod *api.Pod, existingPods []*api.Pod, node string) (bool, error) {
|
func (r *ResourceFit) PodFitsResources(pod *api.Pod, existingPods []*api.Pod, node string) (bool, error) {
|
||||||
podRequest := getResourceRequest(pod)
|
podRequest := getResourceRequest(pod)
|
||||||
@ -159,21 +163,21 @@ func (r *ResourceFit) PodFitsResources(pod *api.Pod, existingPods []*api.Pod, no
|
|||||||
pods = append(existingPods, pod)
|
pods = append(existingPods, pod)
|
||||||
_, exceedingCPU, exceedingMemory := CheckPodsExceedingFreeResources(pods, info.Status.Capacity)
|
_, exceedingCPU, exceedingMemory := CheckPodsExceedingFreeResources(pods, info.Status.Capacity)
|
||||||
if int64(len(pods)) > info.Status.Capacity.Pods().Value() {
|
if int64(len(pods)) > info.Status.Capacity.Pods().Value() {
|
||||||
glog.V(4).Infof("Cannot schedule Pod %+v, because Node %+v is full, running %v out of %v Pods.", pod, node, len(pods)-1, info.Status.Capacity.Pods().Value())
|
glog.V(10).Infof("Cannot schedule Pod %+v, because Node %+v is full, running %v out of %v Pods.", podName(pod), node, len(pods)-1, info.Status.Capacity.Pods().Value())
|
||||||
FailedResourceType = "PodExceedsMaxPodNumber"
|
FailedResourceType = "PodExceedsMaxPodNumber"
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if len(exceedingCPU) > 0 {
|
if len(exceedingCPU) > 0 {
|
||||||
glog.V(4).Infof("Cannot schedule Pod %+v, because Node does not have sufficient CPU", pod)
|
glog.V(10).Infof("Cannot schedule Pod %+v, because Node %v does not have sufficient CPU", podName(pod), node)
|
||||||
FailedResourceType = "PodExceedsFreeCPU"
|
FailedResourceType = "PodExceedsFreeCPU"
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if len(exceedingMemory) > 0 {
|
if len(exceedingMemory) > 0 {
|
||||||
glog.V(4).Infof("Cannot schedule Pod %+v, because Node does not have sufficient Memory", pod)
|
glog.V(10).Infof("Cannot schedule Pod %+v, because Node %v does not have sufficient Memory", podName(pod), node)
|
||||||
FailedResourceType = "PodExceedsFreeMemory"
|
FailedResourceType = "PodExceedsFreeMemory"
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Schedule Pod %+v on Node %+v is allowed, Node is running only %v out of %v Pods.", pod, node, len(pods)-1, info.Status.Capacity.Pods().Value())
|
glog.V(10).Infof("Schedule Pod %+v on Node %+v is allowed, Node is running only %v out of %v Pods.", podName(pod), node, len(pods)-1, info.Status.Capacity.Pods().Value())
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user