diff --git a/pkg/policyconditions/conditions.go b/pkg/policyconditions/conditions.go index 6c9b4e0fd..00eac047f 100644 --- a/pkg/policyconditions/conditions.go +++ b/pkg/policyconditions/conditions.go @@ -94,8 +94,8 @@ func nodesRunningNmstate(cli client.Client) ([]corev1.Node, error) { } pods := corev1.PodList{} - byApp := client.MatchingLabels{"app": "kubernetes-nmstate"} - err = cli.List(context.TODO(), &pods, byApp) + byComponent := client.MatchingLabels{"component": "kubernetes-nmstate-handler"} + err = cli.List(context.TODO(), &pods, byComponent) if err != nil { return []corev1.Node{}, errors.Wrap(err, "getting pods failed") } diff --git a/pkg/policyconditions/conditions_test.go b/pkg/policyconditions/conditions_test.go index 3ff89a021..8c836d0d1 100644 --- a/pkg/policyconditions/conditions_test.go +++ b/pkg/policyconditions/conditions_test.go @@ -69,13 +69,13 @@ func newNode(idx int) corev1.Node { return node } -func newPodAtNode(idx int, name string, namespace string, app string) corev1.Pod { +func newPodAtNode(idx int, name string, namespace string, component string) corev1.Pod { pod := corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-%d", name, idx), Namespace: namespace, Labels: map[string]string{ - "app": app, + "component": component, }, }, Spec: corev1.PodSpec{ @@ -86,7 +86,7 @@ func newPodAtNode(idx int, name string, namespace string, app string) corev1.Pod } func newNmstatePodAtNode(idx int) corev1.Pod { - return newPodAtNode(idx, "nmstate-handler", "nmstate", "kubernetes-nmstate") + return newPodAtNode(idx, "nmstate-handler", "nmstate", "kubernetes-nmstate-handler") } func newNonNmstatePodAtNode(idx int) corev1.Pod {