From a38d764ffc164e0005503ddcc854df4853edb5ec Mon Sep 17 00:00:00 2001 From: Roman Dobosz Date: Thu, 2 Jun 2022 14:00:36 +0200 Subject: [PATCH] Get rid of obsolete KuryrNetPolicy CRD. There are some of the mentions of KuryrNetPolicy around our code. In this patch we are removing it (with one exception - the spec for originally designed CRD for network policy handling), just to avoid confusion with currently used KuryrNetworkPolicy. Change-Id: Ie9bb46467a249e1c0ada3a9810c4fff59fd57757 --- devstack/lib/kuryr_kubernetes | 1 - doc/source/installation/manual.rst | 1 - kuryr_kubernetes/constants.py | 2 -- .../test_network_policy_security_groups.py | 6 ++--- kuryr_kubernetes/tests/unit/test_utils.py | 22 +------------------ kuryr_kubernetes/utils.py | 1 - 6 files changed, 4 insertions(+), 29 deletions(-) diff --git a/devstack/lib/kuryr_kubernetes b/devstack/lib/kuryr_kubernetes index 1ae8000d1..ef7a35d76 100644 --- a/devstack/lib/kuryr_kubernetes +++ b/devstack/lib/kuryr_kubernetes @@ -415,7 +415,6 @@ rules: verbs: ["*"] resources: - kuryrnetworks - - kuryrnetpolicies - kuryrnetworkpolicies - kuryrloadbalancers - kuryrports diff --git a/doc/source/installation/manual.rst b/doc/source/installation/manual.rst index f6760371c..b51e1e3c9 100644 --- a/doc/source/installation/manual.rst +++ b/doc/source/installation/manual.rst @@ -93,7 +93,6 @@ Edit ``kuryr.conf``: verbs: ["*"] resources: - kuryrnetworks - - kuryrnetpolicies - kuryrnetworkpolicies - kuryrloadbalancers - apiGroups: ["networking.k8s.io"] diff --git a/kuryr_kubernetes/constants.py b/kuryr_kubernetes/constants.py index 9ec38fbf4..738026699 100644 --- a/kuryr_kubernetes/constants.py +++ b/kuryr_kubernetes/constants.py @@ -22,7 +22,6 @@ K8S_API_CRD_VERSION = 'openstack.org/v1' K8S_API_CRD = '/apis/' + K8S_API_CRD_VERSION K8S_API_CRD_NAMESPACES = K8S_API_CRD + '/namespaces' K8S_API_CRD_KURYRNETWORKS = K8S_API_CRD + '/kuryrnetworks' -K8S_API_CRD_KURYRNETPOLICIES = K8S_API_CRD + '/kuryrnetpolicies' K8S_API_CRD_KURYRNETWORKPOLICIES = K8S_API_CRD + '/kuryrnetworkpolicies' K8S_API_CRD_KURYRLOADBALANCERS = K8S_API_CRD + '/kuryrloadbalancers' K8S_API_CRD_KURYRPORTS = K8S_API_CRD + '/kuryrports' @@ -38,7 +37,6 @@ K8S_OBJ_SERVICE = 'Service' K8S_OBJ_ENDPOINTS = 'Endpoints' K8S_OBJ_POLICY = 'NetworkPolicy' K8S_OBJ_KURYRNETWORK = 'KuryrNetwork' -K8S_OBJ_KURYRNETPOLICY = 'KuryrNetPolicy' K8S_OBJ_KURYRNETWORKPOLICY = 'KuryrNetworkPolicy' K8S_OBJ_KURYRLOADBALANCER = 'KuryrLoadBalancer' K8S_OBJ_KURYRPORT = 'KuryrPort' diff --git a/kuryr_kubernetes/tests/unit/controller/drivers/test_network_policy_security_groups.py b/kuryr_kubernetes/tests/unit/controller/drivers/test_network_policy_security_groups.py index 6f45228c1..b41bc4fd1 100644 --- a/kuryr_kubernetes/tests/unit/controller/drivers/test_network_policy_security_groups.py +++ b/kuryr_kubernetes/tests/unit/controller/drivers/test_network_policy_security_groups.py @@ -100,7 +100,7 @@ def get_matched_crd_obj(): def get_crd_obj_no_match(): return { - "kind": "KuryrNetPolicy", + "kind": "KuryrNetworkPolicy", "metadata": {"name": "np-test-network-policy", "namespace": "default"}, "spec": { @@ -122,7 +122,7 @@ def get_crd_obj_no_match(): def get_crd_obj_with_all_selectors(): return { - "kind": "KuryrNetPolicy", + "kind": "KuryrNetworkPolicy", "metadata": {"name": "np-test-network-policy", "namespace": "default"}, "spec": { @@ -304,7 +304,7 @@ class TestNetworkPolicySecurityGroupsDriver(test_base.TestCase): self._new_rule_id = mock.sentinel.id self._crd_with_rule = { "apiVersion": "openstack.org/v1", - "kind": "KuryrNetPolicy", + "kind": "KuryrNetworkPolicy", "metadata": {"name": "np-test-network-policy", "namespace": "default"}, "spec": { diff --git a/kuryr_kubernetes/tests/unit/test_utils.py b/kuryr_kubernetes/tests/unit/test_utils.py index 5e59c1006..9887cf1b2 100644 --- a/kuryr_kubernetes/tests/unit/test_utils.py +++ b/kuryr_kubernetes/tests/unit/test_utils.py @@ -132,29 +132,9 @@ class TestUtils(test_base.TestCase): self.assertEqual(resp, True) - def test__has_kuryrnetpolicy_crd(self): - kuryrnetpolicies_crd = { - "apiVersion": "openstack.org/v1", - "items": [ - - ], - "kind": "KuryrNetPolicyList", - "metadata": { - "continue": "", - "resourceVersion": "34186", - } - } - kubernetes = self.useFixture(k_fix.MockK8sClient()).client - kubernetes.get.return_value = kuryrnetpolicies_crd - - kuryrnetpolicies_url = k_const.K8S_API_CRD_KURYRNETPOLICIES - resp = utils.has_kuryr_crd(kuryrnetpolicies_url) - - self.assertEqual(resp, True) - def test__has_kuryr_crd_error(self): crds = [k_const.K8S_API_CRD_KURYRNETWORKS, - k_const.K8S_API_CRD_KURYRNETPOLICIES, + k_const.K8S_API_CRD_KURYRNETWORKPOLICIES, k_const.K8S_API_CRD_KURYRLOADBALANCERS] for crd_url in crds: diff --git a/kuryr_kubernetes/utils.py b/kuryr_kubernetes/utils.py index 2d8993798..83ce480ab 100644 --- a/kuryr_kubernetes/utils.py +++ b/kuryr_kubernetes/utils.py @@ -85,7 +85,6 @@ cache.configure_cache_region(CONF, nodes_cache_region) RESOURCE_MAP = {'Endpoints': 'endpoints', 'KuryrLoadBalancer': 'kuryrloadbalancers', - 'KuryrNetPolicy': 'kuryrnetpolicies', 'KuryrNetwork': 'kuryrnetworks', 'KuryrNetworkPolicy': 'kuryrnetworkpolicies', 'KuryrPort': 'kuryrports',