Remove support for OCP Routes

That support is long gone from kuryr-kubernetes and this commit removes
the tests that are no longer needed.

Change-Id: I3593285d09ecde0c2bdc14805adc39630a592a49
This commit is contained in:
Michał Dulko 2022-03-01 13:21:16 +01:00
parent 85807e55a9
commit d7dd6b2eb6
2 changed files with 0 additions and 187 deletions

View File

@ -48,12 +48,7 @@ KURYR_PORT_CRD_PLURAL = 'kuryrports'
KURYR_LOAD_BALANCER_CRD_PLURAL = 'kuryrloadbalancers'
K8S_ANNOTATION_PREFIX = 'openstack.org/kuryr'
K8S_ANNOTATION_LBAAS_STATE = K8S_ANNOTATION_PREFIX + '-lbaas-state'
K8S_ANNOTATION_LBAAS_RT_STATE = K8S_ANNOTATION_PREFIX + '-lbaas-route-state'
KURYR_ROUTE_DEL_VERIFY_TIMEOUT = 30
KURYR_CONTROLLER = 'kuryr-controller'
OS_ROUTES_API = 'route.openshift.io'
OS_ROUTES_VERSION = 'v1'
OS_ROUTES_PLURAL = "routes"
class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
@ -1280,96 +1275,6 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
)
retry_attempts -= 1
@classmethod
def create_route(cls, name, hostname, target_svc, namespace='default'):
route_manifest = {
'apiVersion': 'route.openshift.io/v1',
'kind': 'Route',
'metadata':
{
'name': name,
},
'spec':
{
'host': hostname,
'to':
{
'kind': 'Service',
'name': target_svc
}
}
}
cls.k8s_client.CustomObjectsApi().create_namespaced_custom_object(
OS_ROUTES_API, OS_ROUTES_VERSION, namespace, OS_ROUTES_PLURAL,
route_manifest)
LOG.info("Route=%s created, wait for kuryr-annotation", name)
cls.wait_kuryr_annotation(
group=OS_ROUTES_API, version=OS_ROUTES_VERSION,
plural=OS_ROUTES_PLURAL,
annotation='openstack.org/kuryr-route-state', timeout_period=110,
name=name)
LOG.info("Found %s string in Route=%s annotation ",
'openstack.org/kuryr-route-state', name)
@classmethod
def verify_route_endpoints_configured(cls, ep_name, namespace='default'):
cls._verify_endpoints_annotation(
ep_name=ep_name, ann_string=K8S_ANNOTATION_LBAAS_RT_STATE,
poll_interval=3)
@classmethod
def delete_route(cls, name, namespace='default'):
body = cls.k8s_client.V1DeleteOptions()
try:
cls.k8s_client.CustomObjectsApi().delete_namespaced_custom_object(
OS_ROUTES_API, OS_ROUTES_VERSION, namespace, OS_ROUTES_PLURAL,
name, body)
except kubernetes.client.rest.ApiException as e:
if e.status == 404:
return
raise
# FIXME(yboaron): Use other method (instead of constant delay)
# to verify that route was deleted
time.sleep(KURYR_ROUTE_DEL_VERIFY_TIMEOUT)
def verify_route_http(self, router_fip, hostname, amount,
should_succeed=True):
LOG.info("Trying to curl the route, Router_FIP=%s, hostname=%s, "
"should_succeed=%s", router_fip, hostname, should_succeed)
def req():
if should_succeed:
# FIXME(yboaron): From some reason for route use case,
# sometimes only one of service's pods is responding to CURL
# although all members and L7 policy were created at Octavia.
# so as workaround - I added a constant delay
time.sleep(1)
resp = requests.get('http://{}'.format(router_fip),
headers={'Host': hostname})
return resp.status_code, resp.content
def pred(tester, responses):
contents = []
for resp in responses:
status_code, content = resp
if should_succeed:
contents.append(content)
else:
tester.assertEqual(requests.codes.SERVICE_UNAVAILABLE,
status_code)
if should_succeed:
unique_resps = set(contents)
tester.assertEqual(amount, len(unique_resps),
'Incorrect amount of unique backends. '
'Got {}'.format(unique_resps))
self._run_and_assert(
req, pred, retry_repetitions=consts.REPETITIONS_PER_BACKEND*amount)
def create_and_ping_pod(self):
name, pod = self.create_pod()
self.addCleanup(self.delete_pod, name)

View File

@ -1,92 +0,0 @@
# Copyright 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from kuryr_tempest_plugin.tests.scenario import base
from oslo_log import log as logging
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
LOG = logging.getLogger(__name__)
CONF = config.CONF
FIRST_ROUTE_NAME = 'firstroute'
FIRST_ROUTE_HOST_NAME = 'www.first.com'
SECOND_ROUTE_NAME = 'secondroute'
SECOND_ROUTE_HOST_NAME = 'www.second.com'
class TestOcpRouteScenario(base.BaseKuryrScenarioTest):
@classmethod
def skip_checks(cls):
super(TestOcpRouteScenario, cls).skip_checks()
if CONF.kuryr_kubernetes.ocp_router_fip is None:
raise cls.skipException(
"OCP router fip should be specified to run this tests.")
@decorators.idempotent_id('bddf0001-1244-449d-a125-b5fdcfa1a7a9')
def test_create_route_after_service(self):
self.create_setup_for_service_test()
self.addCleanup(self.delete_route, FIRST_ROUTE_NAME)
self.create_route(FIRST_ROUTE_NAME, FIRST_ROUTE_HOST_NAME,
self.service_name)
self.verify_route_endpoints_configured(self.service_name)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
FIRST_ROUTE_HOST_NAME,
self.pod_num)
self.delete_route(FIRST_ROUTE_NAME)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
FIRST_ROUTE_HOST_NAME,
self.pod_num,
should_succeed=False)
@decorators.idempotent_id('bddf0002-1244-449d-a125-b5fdcfa1a7a9')
def test_two_routes_same_service(self):
self.create_setup_for_service_test()
self.addCleanup(self.delete_route, FIRST_ROUTE_NAME)
self.create_route(FIRST_ROUTE_NAME, FIRST_ROUTE_HOST_NAME,
self.service_name)
self.addCleanup(self.delete_route, SECOND_ROUTE_NAME)
self.create_route(SECOND_ROUTE_NAME, SECOND_ROUTE_HOST_NAME,
self.service_name)
self.verify_route_endpoints_configured(self.service_name)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
FIRST_ROUTE_HOST_NAME,
self.pod_num)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
SECOND_ROUTE_HOST_NAME,
self.pod_num)
self.delete_route(FIRST_ROUTE_NAME)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
SECOND_ROUTE_HOST_NAME,
self.pod_num)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
FIRST_ROUTE_HOST_NAME,
self.pod_num,
should_succeed=False)
@decorators.idempotent_id('bddf0003-1244-449d-a125-b5fdcfa1a7a9')
def test_create_route_before_service(self):
service_name = data_utils.rand_name(prefix='kuryr-service')
self.addCleanup(self.delete_route, FIRST_ROUTE_NAME)
self.create_route(FIRST_ROUTE_NAME, FIRST_ROUTE_HOST_NAME,
service_name)
self.create_setup_for_service_test(service_name=service_name)
self.verify_route_endpoints_configured(service_name)
self.verify_route_http(CONF.kuryr_kubernetes.ocp_router_fip,
FIRST_ROUTE_HOST_NAME,
self.pod_num)