From 3d0cee395f9bb490c9921d242afec6c4ee7b3e74 Mon Sep 17 00:00:00 2001 From: Denis Romanenko Date: Wed, 4 Sep 2024 21:06:53 +0300 Subject: [PATCH] Support of the namespaceLabelSelector in DefaultEvictor plugin --- pkg/framework/plugins/defaultevictor/defaultevictor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/framework/plugins/defaultevictor/defaultevictor.go b/pkg/framework/plugins/defaultevictor/defaultevictor.go index 6fb3b70723..092e6f5482 100644 --- a/pkg/framework/plugins/defaultevictor/defaultevictor.go +++ b/pkg/framework/plugins/defaultevictor/defaultevictor.go @@ -222,7 +222,7 @@ func (d *DefaultEvictor) PreEvictionFilter(pod *v1.Pod) bool { // check pod by namespace label filter if d.args.NamespaceLabelSelector != nil { - ns, err := getNamespaces(context.TODO(), d.handle.ClientSet(), d.handle.SharedInformerFactory().Core().V1().Namespaces().Lister(), metav1.FormatLabelSelector(d.args.NamespaceLabelSelector)) + ns, err := getNamespacesListByLabelSelector(context.TODO(), d.handle.ClientSet(), d.handle.SharedInformerFactory().Core().V1().Namespaces().Lister(), metav1.FormatLabelSelector(d.args.NamespaceLabelSelector)) if err != nil { klog.ErrorS(err, "unable to list namespaces", "pod", klog.KObj(pod)) } @@ -296,7 +296,7 @@ func getPodIndexerByOwnerRefs(indexName string, handle frameworktypes.Handle) (c return indexer, nil } -func getNamespaces(ctx context.Context, client clientset.Interface, nsLister listersv1.NamespaceLister, labelSelector string) (map[string]struct{}, error) { +func getNamespacesListByLabelSelector(ctx context.Context, client clientset.Interface, nsLister listersv1.NamespaceLister, labelSelector string) (map[string]struct{}, error) { ret := make(map[string]struct{}) namespaceSelector, err := labels.Parse(labelSelector) if err != nil {