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
This commit is contained in:
Roman Dobosz 2022-06-02 14:00:36 +02:00
parent be428a5b4b
commit a38d764ffc
6 changed files with 4 additions and 29 deletions

View File

@ -415,7 +415,6 @@ rules:
verbs: ["*"] verbs: ["*"]
resources: resources:
- kuryrnetworks - kuryrnetworks
- kuryrnetpolicies
- kuryrnetworkpolicies - kuryrnetworkpolicies
- kuryrloadbalancers - kuryrloadbalancers
- kuryrports - kuryrports

View File

@ -93,7 +93,6 @@ Edit ``kuryr.conf``:
verbs: ["*"] verbs: ["*"]
resources: resources:
- kuryrnetworks - kuryrnetworks
- kuryrnetpolicies
- kuryrnetworkpolicies - kuryrnetworkpolicies
- kuryrloadbalancers - kuryrloadbalancers
- apiGroups: ["networking.k8s.io"] - apiGroups: ["networking.k8s.io"]

View File

@ -22,7 +22,6 @@ K8S_API_CRD_VERSION = 'openstack.org/v1'
K8S_API_CRD = '/apis/' + K8S_API_CRD_VERSION K8S_API_CRD = '/apis/' + K8S_API_CRD_VERSION
K8S_API_CRD_NAMESPACES = K8S_API_CRD + '/namespaces' K8S_API_CRD_NAMESPACES = K8S_API_CRD + '/namespaces'
K8S_API_CRD_KURYRNETWORKS = K8S_API_CRD + '/kuryrnetworks' 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_KURYRNETWORKPOLICIES = K8S_API_CRD + '/kuryrnetworkpolicies'
K8S_API_CRD_KURYRLOADBALANCERS = K8S_API_CRD + '/kuryrloadbalancers' K8S_API_CRD_KURYRLOADBALANCERS = K8S_API_CRD + '/kuryrloadbalancers'
K8S_API_CRD_KURYRPORTS = K8S_API_CRD + '/kuryrports' K8S_API_CRD_KURYRPORTS = K8S_API_CRD + '/kuryrports'
@ -38,7 +37,6 @@ K8S_OBJ_SERVICE = 'Service'
K8S_OBJ_ENDPOINTS = 'Endpoints' K8S_OBJ_ENDPOINTS = 'Endpoints'
K8S_OBJ_POLICY = 'NetworkPolicy' K8S_OBJ_POLICY = 'NetworkPolicy'
K8S_OBJ_KURYRNETWORK = 'KuryrNetwork' K8S_OBJ_KURYRNETWORK = 'KuryrNetwork'
K8S_OBJ_KURYRNETPOLICY = 'KuryrNetPolicy'
K8S_OBJ_KURYRNETWORKPOLICY = 'KuryrNetworkPolicy' K8S_OBJ_KURYRNETWORKPOLICY = 'KuryrNetworkPolicy'
K8S_OBJ_KURYRLOADBALANCER = 'KuryrLoadBalancer' K8S_OBJ_KURYRLOADBALANCER = 'KuryrLoadBalancer'
K8S_OBJ_KURYRPORT = 'KuryrPort' K8S_OBJ_KURYRPORT = 'KuryrPort'

View File

@ -100,7 +100,7 @@ def get_matched_crd_obj():
def get_crd_obj_no_match(): def get_crd_obj_no_match():
return { return {
"kind": "KuryrNetPolicy", "kind": "KuryrNetworkPolicy",
"metadata": {"name": "np-test-network-policy", "metadata": {"name": "np-test-network-policy",
"namespace": "default"}, "namespace": "default"},
"spec": { "spec": {
@ -122,7 +122,7 @@ def get_crd_obj_no_match():
def get_crd_obj_with_all_selectors(): def get_crd_obj_with_all_selectors():
return { return {
"kind": "KuryrNetPolicy", "kind": "KuryrNetworkPolicy",
"metadata": {"name": "np-test-network-policy", "metadata": {"name": "np-test-network-policy",
"namespace": "default"}, "namespace": "default"},
"spec": { "spec": {
@ -304,7 +304,7 @@ class TestNetworkPolicySecurityGroupsDriver(test_base.TestCase):
self._new_rule_id = mock.sentinel.id self._new_rule_id = mock.sentinel.id
self._crd_with_rule = { self._crd_with_rule = {
"apiVersion": "openstack.org/v1", "apiVersion": "openstack.org/v1",
"kind": "KuryrNetPolicy", "kind": "KuryrNetworkPolicy",
"metadata": {"name": "np-test-network-policy", "metadata": {"name": "np-test-network-policy",
"namespace": "default"}, "namespace": "default"},
"spec": { "spec": {

View File

@ -132,29 +132,9 @@ class TestUtils(test_base.TestCase):
self.assertEqual(resp, True) 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): def test__has_kuryr_crd_error(self):
crds = [k_const.K8S_API_CRD_KURYRNETWORKS, 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] k_const.K8S_API_CRD_KURYRLOADBALANCERS]
for crd_url in crds: for crd_url in crds:

View File

@ -85,7 +85,6 @@ cache.configure_cache_region(CONF, nodes_cache_region)
RESOURCE_MAP = {'Endpoints': 'endpoints', RESOURCE_MAP = {'Endpoints': 'endpoints',
'KuryrLoadBalancer': 'kuryrloadbalancers', 'KuryrLoadBalancer': 'kuryrloadbalancers',
'KuryrNetPolicy': 'kuryrnetpolicies',
'KuryrNetwork': 'kuryrnetworks', 'KuryrNetwork': 'kuryrnetworks',
'KuryrNetworkPolicy': 'kuryrnetworkpolicies', 'KuryrNetworkPolicy': 'kuryrnetworkpolicies',
'KuryrPort': 'kuryrports', 'KuryrPort': 'kuryrports',