improve logging of pod admission denied
This commit is contained in:
		@@ -212,7 +212,6 @@ func (m *manager) RemoveContainer(containerID string) error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (m *manager) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAdmitResult {
 | 
					func (m *manager) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAdmitResult {
 | 
				
			||||||
	klog.InfoS("Topology Admit Handler", "podUID", attrs.Pod.UID, "podNamespace", attrs.Pod.Namespace, "podName", attrs.Pod.Name)
 | 
					 | 
				
			||||||
	metrics.TopologyManagerAdmissionRequestsTotal.Inc()
 | 
						metrics.TopologyManagerAdmissionRequestsTotal.Inc()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	startTime := time.Now()
 | 
						startTime := time.Now()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -172,8 +172,6 @@ func (m *managerImpl) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// reject pods when under memory pressure (if pod is best effort), or if under disk pressure.
 | 
					 | 
				
			||||||
	klog.InfoS("Failed to admit pod to node", "pod", klog.KObj(attrs.Pod), "nodeCondition", m.nodeConditions)
 | 
					 | 
				
			||||||
	return lifecycle.PodAdmitResult{
 | 
						return lifecycle.PodAdmitResult{
 | 
				
			||||||
		Admit:   false,
 | 
							Admit:   false,
 | 
				
			||||||
		Reason:  Reason,
 | 
							Reason:  Reason,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2325,6 +2325,9 @@ func (kl *Kubelet) canAdmitPod(pods []*v1.Pod, pod *v1.Pod) (bool, string, strin
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	for _, podAdmitHandler := range kl.admitHandlers {
 | 
						for _, podAdmitHandler := range kl.admitHandlers {
 | 
				
			||||||
		if result := podAdmitHandler.Admit(attrs); !result.Admit {
 | 
							if result := podAdmitHandler.Admit(attrs); !result.Admit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								klog.InfoS("Pod admission denied", "podUID", attrs.Pod.UID, "pod", klog.KObj(attrs.Pod), "reason", result.Reason, "message", result.Message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return false, result.Reason, result.Message
 | 
								return false, result.Reason, result.Message
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user