Skip to content

Commit

Permalink
Use helper function to check if Label Selector matches the given Labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Kun483 committed Aug 7, 2024
1 parent f4becf2 commit 2526540
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2526540

Please sign in to comment.