From e68beb6c97d650a217c74abb3ea727c70d08a5bf Mon Sep 17 00:00:00 2001 From: Artur Zheludkov Date: Thu, 8 Feb 2024 11:11:07 -0500 Subject: [PATCH] keep only pod-selector for egress rules --- operator/redisfailover/service/generator.go | 7 ------- .../redisfailover/service/generator_test.go | 21 ------------------- 2 files changed, 28 deletions(-) diff --git a/operator/redisfailover/service/generator.go b/operator/redisfailover/service/generator.go index 5798f28fe..cb15228e2 100644 --- a/operator/redisfailover/service/generator.go +++ b/operator/redisfailover/service/generator.go @@ -511,13 +511,6 @@ func generateSentinelNetworkPolicy(rf *redisfailoverv1.RedisFailover, labels map Egress: []np.NetworkPolicyEgressRule{ np.NetworkPolicyEgressRule{ To: []np.NetworkPolicyPeer{ - np.NetworkPolicyPeer{ - NamespaceSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app.kubernetes.io/instance": namespace, - }, - }, - }, np.NetworkPolicyPeer{ PodSelector: &metav1.LabelSelector{ MatchLabels: redisfailoverLabels, diff --git a/operator/redisfailover/service/generator_test.go b/operator/redisfailover/service/generator_test.go index b439fffab..91567f75e 100644 --- a/operator/redisfailover/service/generator_test.go +++ b/operator/redisfailover/service/generator_test.go @@ -1481,13 +1481,6 @@ func TestSentinelNetworkPolicy(t *testing.T) { Egress: []networkingv1.NetworkPolicyEgressRule{ networkingv1.NetworkPolicyEgressRule{ To: []networkingv1.NetworkPolicyPeer{ - networkingv1.NetworkPolicyPeer{ - NamespaceSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app.kubernetes.io/instance": namespace, - }, - }, - }, networkingv1.NetworkPolicyPeer{ PodSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -1557,13 +1550,6 @@ func TestSentinelNetworkPolicy(t *testing.T) { Egress: []networkingv1.NetworkPolicyEgressRule{ networkingv1.NetworkPolicyEgressRule{ To: []networkingv1.NetworkPolicyPeer{ - networkingv1.NetworkPolicyPeer{ - NamespaceSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app.kubernetes.io/instance": namespace, - }, - }, - }, networkingv1.NetworkPolicyPeer{ PodSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -1643,13 +1629,6 @@ func TestSentinelNetworkPolicy(t *testing.T) { Egress: []networkingv1.NetworkPolicyEgressRule{ networkingv1.NetworkPolicyEgressRule{ To: []networkingv1.NetworkPolicyPeer{ - networkingv1.NetworkPolicyPeer{ - NamespaceSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app.kubernetes.io/instance": namespace, - }, - }, - }, networkingv1.NetworkPolicyPeer{ PodSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{