From 25265400d55fcf8fa47a0f001d8a712dfc4ceb10 Mon Sep 17 00:00:00 2001 From: kun zhou Date: Wed, 7 Aug 2024 12:16:20 -0700 Subject: [PATCH] Use helper function to check if Label Selector matches the given Labels --- internal/controllers/machine/machine_controller.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/controllers/machine/machine_controller.go b/internal/controllers/machine/machine_controller.go index 80792b534d1e..f8d5cea4830d 100644 --- a/internal/controllers/machine/machine_controller.go +++ b/internal/controllers/machine/machine_controller.go @@ -26,7 +26,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/wait" @@ -652,7 +651,7 @@ func SkipFuncGenerator(labelSelector *metav1.LabelSelector) func(pod corev1.Pod) if pod.Labels == nil { return kubedrain.MakePodDeleteStatusOkay() } - if labels.Equals(labelSelector.MatchLabels, pod.ObjectMeta.Labels) { + if HasMatchingLabels(*labelSelector, pod.ObjectMeta.Labels) { return kubedrain.MakePodDeleteStatusSkip() } return kubedrain.MakePodDeleteStatusOkay()