mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
Add namespace to pod eviction log messages
In multi-tenant environments it is useful to know which namespace a pod was evicted from. Therefore log the namespace when evicting pods. Also, do not log a nil error when successfully evicting pods.
This commit is contained in:
@@ -91,11 +91,11 @@ func (pe *PodEvictor) EvictPod(ctx context.Context, pod *v1.Pod, node *v1.Node)
|
||||
success, err = EvictPod(ctx, pe.client, pod, pe.policyGroupVersion, pe.dryRun)
|
||||
if success {
|
||||
pe.nodepodCount[node]++
|
||||
klog.V(1).Infof("Evicted pod: %#v (%#v)", pod.Name, err)
|
||||
klog.V(1).Infof("Evicted pod: %#v in namespace %#v", pod.Name, pod.Namespace)
|
||||
return success, nil
|
||||
}
|
||||
// err is used only for logging purposes
|
||||
klog.Errorf("Error when evicting pod: %#v (%#v)", pod.Name, err)
|
||||
klog.Errorf("Error evicting pod: %#v in namespace %#v (%#v)", pod.Name, pod.Namespace, err)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user