Skip to content

Commit

Permalink
Support of the namespaceLabelSelector in DefaultEvictor plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanenkoDenys committed Sep 4, 2024
1 parent e18ba47 commit 3d0cee3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/framework/plugins/defaultevictor/defaultevictor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 3d0cee3

Please sign in to comment.