From 4819ab9c6992e1e4952811e068985cdd6d6f8058 Mon Sep 17 00:00:00 2001 From: Sean Malloy Date: Tue, 12 May 2020 00:10:26 -0500 Subject: [PATCH] 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. --- pkg/descheduler/evictions/evictions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/descheduler/evictions/evictions.go b/pkg/descheduler/evictions/evictions.go index 2e400fac6..d234c833c 100644 --- a/pkg/descheduler/evictions/evictions.go +++ b/pkg/descheduler/evictions/evictions.go @@ -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 }