diff --git a/deployments/daemon-set/nginx-ingress.yaml b/deployments/daemon-set/nginx-ingress.yaml index 2c7283d9df..6e7b1cea1a 100644 --- a/deployments/daemon-set/nginx-ingress.yaml +++ b/deployments/daemon-set/nginx-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: nginx-ingress diff --git a/deployments/daemon-set/nginx-plus-ingress.yaml b/deployments/daemon-set/nginx-plus-ingress.yaml index 9afab5d538..39208c3c07 100644 --- a/deployments/daemon-set/nginx-plus-ingress.yaml +++ b/deployments/daemon-set/nginx-plus-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: nginx-ingress diff --git a/deployments/deployment/nginx-ingress.yaml b/deployments/deployment/nginx-ingress.yaml index 4963c55d4b..a684aa8038 100644 --- a/deployments/deployment/nginx-ingress.yaml +++ b/deployments/deployment/nginx-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: nginx-ingress diff --git a/deployments/deployment/nginx-plus-ingress.yaml b/deployments/deployment/nginx-plus-ingress.yaml index 40334c4b72..128b1ec0eb 100644 --- a/deployments/deployment/nginx-plus-ingress.yaml +++ b/deployments/deployment/nginx-plus-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: nginx-ingress diff --git a/deployments/helm-chart/templates/controller-daemonset.yaml b/deployments/helm-chart/templates/controller-daemonset.yaml index e1a2dec13c..2b6be3bdf3 100644 --- a/deployments/helm-chart/templates/controller-daemonset.yaml +++ b/deployments/helm-chart/templates/controller-daemonset.yaml @@ -1,5 +1,5 @@ {{- if eq .Values.controller.kind "daemonset" }} -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: {{ default (include "nginx-ingress.name" .) .Values.controller.name }} diff --git a/deployments/helm-chart/templates/controller-deployment.yaml b/deployments/helm-chart/templates/controller-deployment.yaml index fe3e99660a..45cf0d607e 100644 --- a/deployments/helm-chart/templates/controller-deployment.yaml +++ b/deployments/helm-chart/templates/controller-deployment.yaml @@ -1,5 +1,5 @@ {{- if eq .Values.controller.kind "deployment" }} -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: {{ default (include "nginx-ingress.name" .) .Values.controller.name }} diff --git a/examples/complete-example/cafe.yaml b/examples/complete-example/cafe.yaml index a5f14a5eb2..2958e4f11d 100644 --- a/examples/complete-example/cafe.yaml +++ b/examples/complete-example/cafe.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: coffee @@ -31,7 +31,7 @@ spec: selector: app: coffee --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: tea @@ -63,4 +63,4 @@ spec: protocol: TCP name: http selector: - app: tea \ No newline at end of file + app: tea diff --git a/examples/mergeable-ingress-types/cafe-master.yaml b/examples/mergeable-ingress-types/cafe-master.yaml index 100d82dbba..17df22acae 100644 --- a/examples/mergeable-ingress-types/cafe-master.yaml +++ b/examples/mergeable-ingress-types/cafe-master.yaml @@ -11,4 +11,4 @@ spec: - cafe.example.com secretName: cafe-secret rules: - - host: cafe.example.com \ No newline at end of file + - host: cafe.example.com diff --git a/examples/mergeable-ingress-types/cafe.yaml b/examples/mergeable-ingress-types/cafe.yaml index a5f14a5eb2..2958e4f11d 100644 --- a/examples/mergeable-ingress-types/cafe.yaml +++ b/examples/mergeable-ingress-types/cafe.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: coffee @@ -31,7 +31,7 @@ spec: selector: app: coffee --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: tea @@ -63,4 +63,4 @@ spec: protocol: TCP name: http selector: - app: tea \ No newline at end of file + app: tea diff --git a/examples/tcp-udp/dns.yaml b/examples/tcp-udp/dns.yaml index cfe4b1f0ce..e97561b748 100644 --- a/examples/tcp-udp/dns.yaml +++ b/examples/tcp-udp/dns.yaml @@ -9,7 +9,7 @@ data: log } --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: coredns @@ -83,4 +83,4 @@ spec: protocol: UDP - name: dns-tcp port: 53 - protocol: TCP \ No newline at end of file + protocol: TCP diff --git a/tests/data/common/app/advanced-routing/app.yaml b/tests/data/common/app/advanced-routing/app.yaml index d1807ce249..a55d5c7991 100644 --- a/tests/data/common/app/advanced-routing/app.yaml +++ b/tests/data/common/app/advanced-routing/app.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend1 @@ -31,7 +31,7 @@ spec: selector: app: backend1 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend2 @@ -65,7 +65,7 @@ spec: selector: app: backend2 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend3 @@ -98,7 +98,7 @@ spec: selector: app: backend3 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend4 diff --git a/tests/data/common/app/simple/app.yaml b/tests/data/common/app/simple/app.yaml index 74873c5634..8c14cf4a2d 100644 --- a/tests/data/common/app/simple/app.yaml +++ b/tests/data/common/app/simple/app.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend1 @@ -31,7 +31,7 @@ spec: selector: app: backend1 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend2 diff --git a/tests/data/common/app/split/app.yaml b/tests/data/common/app/split/app.yaml index 489375c69a..71c30aa739 100644 --- a/tests/data/common/app/split/app.yaml +++ b/tests/data/common/app/split/app.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend1-v1 @@ -31,7 +31,7 @@ spec: selector: app: backend1-v1 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend1-v2 @@ -64,7 +64,7 @@ spec: selector: app: backend1-v2 --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend2 diff --git a/tests/data/common/backend1.yaml b/tests/data/common/backend1.yaml index 9727b9f744..5ae26b6d64 100644 --- a/tests/data/common/backend1.yaml +++ b/tests/data/common/backend1.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: backend1 diff --git a/tests/suite/fixtures.py b/tests/suite/fixtures.py index 5bef845e6d..cbaf8f0deb 100644 --- a/tests/suite/fixtures.py +++ b/tests/suite/fixtures.py @@ -7,7 +7,7 @@ from kubernetes import config, client from kubernetes.client import CoreV1Api, ExtensionsV1beta1Api, RbacAuthorizationV1beta1Api, CustomObjectsApi, \ - ApiextensionsV1beta1Api + ApiextensionsV1beta1Api, AppsV1Api from suite.custom_resources_utils import create_crds_from_yaml, delete_crd, create_virtual_server_from_yaml, \ delete_virtual_server @@ -36,11 +36,13 @@ class KubeApis: """ def __init__(self, v1: CoreV1Api, extensions_v1_beta1: ExtensionsV1beta1Api, + apps_v1_api: AppsV1Api, rbac_v1_beta1: RbacAuthorizationV1beta1Api, api_extensions_v1_beta1: ApiextensionsV1beta1Api, custom_objects: CustomObjectsApi): self.v1 = v1 self.extensions_v1_beta1 = extensions_v1_beta1 + self.apps_v1_api = apps_v1_api self.rbac_v1_beta1 = rbac_v1_beta1 self.api_extensions_v1_beta1 = api_extensions_v1_beta1 self.custom_objects = custom_objects @@ -117,11 +119,11 @@ def ingress_controller(cli_arguments, kube_apis, ingress_controller_prerequisite """ namespace = ingress_controller_prerequisites.namespace print("------------------------- Create IC -----------------------------------") - name = create_ingress_controller(kube_apis.v1, kube_apis.extensions_v1_beta1, cli_arguments, namespace) + name = create_ingress_controller(kube_apis.v1, kube_apis.apps_v1_api, cli_arguments, namespace) def fin(): print("Delete IC:") - delete_ingress_controller(kube_apis.extensions_v1_beta1, name, cli_arguments['deployment-type'], namespace) + delete_ingress_controller(kube_apis.apps_v1_api, name, cli_arguments['deployment-type'], namespace) request.addfinalizer(fin) @@ -193,10 +195,11 @@ def kube_apis(cli_arguments) -> KubeApis: config.load_kube_config(config_file=kubeconfig, context=context_name, persist_config=False) v1 = client.CoreV1Api() extensions_v1_beta1 = client.ExtensionsV1beta1Api() + apps_v1_api = client.AppsV1Api() rbac_v1_beta1 = client.RbacAuthorizationV1beta1Api() api_extensions_v1_beta1 = client.ApiextensionsV1beta1Api() custom_objects = client.CustomObjectsApi() - return KubeApis(v1, extensions_v1_beta1, rbac_v1_beta1, api_extensions_v1_beta1, custom_objects) + return KubeApis(v1, extensions_v1_beta1, apps_v1_api, rbac_v1_beta1, api_extensions_v1_beta1, custom_objects) @pytest.fixture(scope="session", autouse=True) @@ -271,7 +274,7 @@ def crd_ingress_controller(cli_arguments, kube_apis, ingress_controller_prerequi crd_names = create_crds_from_yaml(kube_apis.api_extensions_v1_beta1, f"{DEPLOYMENTS}/common/custom-resource-definitions.yaml") print("------------------------- Create IC -----------------------------------") - name = create_ingress_controller(kube_apis.v1, kube_apis.extensions_v1_beta1, cli_arguments, namespace, + name = create_ingress_controller(kube_apis.v1, kube_apis.apps_v1_api, cli_arguments, namespace, request.param.get('extra_args', None)) ensure_connection_to_public_endpoint(ingress_controller_endpoint.public_ip, ingress_controller_endpoint.port, @@ -282,7 +285,7 @@ def fin(): print("Remove the CRD:") delete_crd(kube_apis.api_extensions_v1_beta1, crd_name) print("Remove the IC:") - delete_ingress_controller(kube_apis.extensions_v1_beta1, name, cli_arguments['deployment-type'], namespace) + delete_ingress_controller(kube_apis.apps_v1_api, name, cli_arguments['deployment-type'], namespace) print("Restore the ClusterRole:") patch_rbac(kube_apis.rbac_v1_beta1, f"{DEPLOYMENTS}/rbac/rbac.yaml") @@ -339,7 +342,7 @@ def virtual_server_setup(request, kube_apis, crd_ingress_controller, ingress_con def fin(): print("Clean up Virtual Server Example:") delete_virtual_server(kube_apis.custom_objects, vs_name, test_namespace) - delete_common_app(kube_apis.v1, kube_apis.extensions_v1_beta1, common_app, test_namespace) + delete_common_app(kube_apis.v1, kube_apis.apps_v1_api, common_app, test_namespace) request.addfinalizer(fin) diff --git a/tests/suite/resources_utils.py b/tests/suite/resources_utils.py index 9faa167059..b42023d53f 100644 --- a/tests/suite/resources_utils.py +++ b/tests/suite/resources_utils.py @@ -5,7 +5,7 @@ import pytest import requests -from kubernetes.client import CoreV1Api, ExtensionsV1beta1Api, RbacAuthorizationV1beta1Api, V1Service +from kubernetes.client import CoreV1Api, ExtensionsV1beta1Api, RbacAuthorizationV1beta1Api, V1Service, AppsV1Api from kubernetes.client.rest import ApiException from kubernetes.stream import stream from kubernetes import client @@ -91,11 +91,11 @@ def cleanup_rbac(rbac_v1_beta1: RbacAuthorizationV1beta1Api, rbac: RBACAuthoriza rbac_v1_beta1.delete_cluster_role(rbac.role, delete_options) -def create_deployment_from_yaml(extensions_v1_beta1: ExtensionsV1beta1Api, namespace, yaml_manifest) -> str: +def create_deployment_from_yaml(apps_v1_api: AppsV1Api, namespace, yaml_manifest) -> str: """ Create a deployment based on yaml file. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param namespace: namespace name :param yaml_manifest: absolute path to file :return: str @@ -103,29 +103,29 @@ def create_deployment_from_yaml(extensions_v1_beta1: ExtensionsV1beta1Api, names print(f"Load {yaml_manifest}") with open(yaml_manifest) as f: dep = yaml.safe_load(f) - return create_deployment(extensions_v1_beta1, namespace, dep) + return create_deployment(apps_v1_api, namespace, dep) -def create_deployment(extensions_v1_beta1: ExtensionsV1beta1Api, namespace, body) -> str: +def create_deployment(apps_v1_api: AppsV1Api, namespace, body) -> str: """ Create a deployment based on a dict. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param namespace: namespace name :param body: dict :return: str """ print("Create a deployment:") - extensions_v1_beta1.create_namespaced_deployment(namespace, body) + apps_v1_api.create_namespaced_deployment(namespace, body) print(f"Deployment created with name '{body['metadata']['name']}'") return body['metadata']['name'] -def create_deployment_with_name(extensions_v1_beta1: ExtensionsV1beta1Api, namespace, name) -> str: +def create_deployment_with_name(apps_v1_api: AppsV1Api, namespace, name) -> str: """ Create a deployment with a specific name based on common yaml file. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param namespace: namespace name :param name: :return: str @@ -137,20 +137,20 @@ def create_deployment_with_name(extensions_v1_beta1: ExtensionsV1beta1Api, names dep['spec']['selector']['matchLabels']['app'] = name dep['spec']['template']['metadata']['labels']['app'] = name dep['spec']['template']['spec']['containers'][0]['name'] = name - return create_deployment(extensions_v1_beta1, namespace, dep) + return create_deployment(apps_v1_api, namespace, dep) -def create_daemon_set(extensions_v1_beta1: ExtensionsV1beta1Api, namespace, body) -> str: +def create_daemon_set(apps_v1_api: AppsV1Api, namespace, body) -> str: """ Create a daemon-set based on a dict. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param namespace: namespace name :param body: dict :return: str """ print("Create a daemon-set:") - extensions_v1_beta1.create_namespaced_daemon_set(namespace, body) + apps_v1_api.create_namespaced_daemon_set(namespace, body) print(f"Daemon-Set created with name '{body['metadata']['name']}'") return body['metadata']['name'] @@ -656,19 +656,19 @@ def create_example_app(kube_apis, app_type, namespace) -> CommonApp: def delete_common_app(v1: CoreV1Api, - extensions_v1_beta1: ExtensionsV1beta1Api, + apps_v1_api: AppsV1Api, common_app: CommonApp, namespace) -> None: """ Delete a common simple application. :param v1: CoreV1Api - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param common_app: CommonApp :param namespace: namespace name :return: """ for deployment in common_app.deployments: - delete_deployment(extensions_v1_beta1, deployment, namespace) + delete_deployment(apps_v1_api, deployment, namespace) for svc in common_app.services: delete_service(v1, svc, namespace) @@ -691,11 +691,11 @@ def delete_service(v1: CoreV1Api, name, namespace) -> None: print(f"Service was removed with name '{name}'") -def delete_deployment(extensions_v1_beta1: ExtensionsV1beta1Api, name, namespace) -> None: +def delete_deployment(apps_v1_api: AppsV1Api, name, namespace) -> None: """ Delete a deployment. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param name: :param namespace: :return: @@ -704,16 +704,16 @@ def delete_deployment(extensions_v1_beta1: ExtensionsV1beta1Api, name, namespace delete_options = client.V1DeleteOptions() delete_options.grace_period_seconds = 0 delete_options.propagation_policy = 'Foreground' - extensions_v1_beta1.delete_namespaced_deployment(name, namespace, delete_options) - ensure_item_removal(extensions_v1_beta1.read_namespaced_deployment_status, name, namespace) + apps_v1_api.delete_namespaced_deployment(name, namespace, delete_options) + ensure_item_removal(apps_v1_api.read_namespaced_deployment_status, name, namespace) print(f"Deployment was removed with name '{name}'") -def delete_daemon_set(extensions_v1_beta1: ExtensionsV1beta1Api, name, namespace) -> None: +def delete_daemon_set(apps_v1_api: AppsV1Api, name, namespace) -> None: """ Delete a daemon-set. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param name: :param namespace: :return: @@ -722,8 +722,8 @@ def delete_daemon_set(extensions_v1_beta1: ExtensionsV1beta1Api, name, namespace delete_options = client.V1DeleteOptions() delete_options.grace_period_seconds = 0 delete_options.propagation_policy = 'Foreground' - extensions_v1_beta1.delete_namespaced_daemon_set(name, namespace, delete_options) - ensure_item_removal(extensions_v1_beta1.read_namespaced_daemon_set_status, name, namespace) + apps_v1_api.delete_namespaced_daemon_set(name, namespace, delete_options) + ensure_item_removal(apps_v1_api.read_namespaced_daemon_set_status, name, namespace) print(f"Daemon-set was removed with name '{name}'") @@ -737,13 +737,13 @@ def wait_before_test(delay=RECONFIGURATION_DELAY) -> None: time.sleep(delay) -def create_ingress_controller(v1: CoreV1Api, extensions_v1_beta1: ExtensionsV1beta1Api, cli_arguments, +def create_ingress_controller(v1: CoreV1Api, apps_v1_api: AppsV1Api, cli_arguments, namespace, args=None) -> str: """ Create an Ingress Controller according to the params. :param v1: CoreV1Api - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: AppsV1Api :param cli_arguments: context name as in kubeconfig :param namespace: namespace name :param args: a list of any extra cli arguments to start IC with @@ -758,28 +758,28 @@ def create_ingress_controller(v1: CoreV1Api, extensions_v1_beta1: ExtensionsV1be if args is not None: dep['spec']['template']['spec']['containers'][0]['args'].extend(args) if cli_arguments['deployment-type'] == 'deployment': - name = create_deployment(extensions_v1_beta1, namespace, dep) + name = create_deployment(apps_v1_api, namespace, dep) else: - name = create_daemon_set(extensions_v1_beta1, namespace, dep) + name = create_daemon_set(apps_v1_api, namespace, dep) wait_until_all_pods_are_ready(v1, namespace) print(f"Ingress Controller was created with name '{name}'") return name -def delete_ingress_controller(extensions_v1_beta1: ExtensionsV1beta1Api, name, dep_type, namespace) -> None: +def delete_ingress_controller(apps_v1_api: AppsV1Api, name, dep_type, namespace) -> None: """ Delete IC according to its type. - :param extensions_v1_beta1: ExtensionsV1beta1Api + :param apps_v1_api: ExtensionsV1beta1Api :param name: name :param dep_type: IC deployment type 'deployment' or 'daemon-set' :param namespace: namespace name :return: """ if dep_type == 'deployment': - delete_deployment(extensions_v1_beta1, name, namespace) + delete_deployment(apps_v1_api, name, namespace) elif dep_type == 'daemon-set': - delete_daemon_set(extensions_v1_beta1, name, namespace) + delete_daemon_set(apps_v1_api, name, namespace) def create_ns_and_sa_from_yaml(v1: CoreV1Api, yaml_manifest) -> str: @@ -825,9 +825,9 @@ def create_items_from_yaml(kube_apis, yaml_manifest, namespace) -> None: elif doc["kind"] == "Service": create_service(kube_apis.v1, namespace, doc) elif doc["kind"] == "Deployment": - create_deployment(kube_apis.extensions_v1_beta1, namespace, doc) + create_deployment(kube_apis.apps_v1_api, namespace, doc) elif doc["kind"] == "DaemonSet": - create_daemon_set(kube_apis.extensions_v1_beta1, namespace, doc) + create_daemon_set(kube_apis.apps_v1_api, namespace, doc) def delete_items_from_yaml(kube_apis, yaml_manifest, namespace) -> None: @@ -852,9 +852,9 @@ def delete_items_from_yaml(kube_apis, yaml_manifest, namespace) -> None: elif doc["kind"] == "Service": delete_service(kube_apis.v1, doc['metadata']['name'], namespace) elif doc["kind"] == "Deployment": - delete_deployment(kube_apis.extensions_v1_beta1, doc['metadata']['name'], namespace) + delete_deployment(kube_apis.apps_v1_api, doc['metadata']['name'], namespace) elif doc["kind"] == "DaemonSet": - delete_daemon_set(kube_apis.extensions_v1_beta1, doc['metadata']['name'], namespace) + delete_daemon_set(kube_apis.apps_v1_api, doc['metadata']['name'], namespace) def ensure_connection(request_url) -> None: diff --git a/tests/suite/test_externalname_service.py b/tests/suite/test_externalname_service.py index 89739e3be8..8187c4ed33 100644 --- a/tests/suite/test_externalname_service.py +++ b/tests/suite/test_externalname_service.py @@ -33,7 +33,10 @@ def __init__(self, public_endpoint: PublicEndpoint, ingress_name, ingress_host, @pytest.fixture(scope="class") -def external_name_setup(request, kube_apis, ingress_controller_prerequisites, ingress_controller_endpoint, ingress_controller, test_namespace) -> ExternalNameSetup: +def external_name_setup(request, + kube_apis, + ingress_controller_prerequisites, + ingress_controller_endpoint, ingress_controller, test_namespace) -> ExternalNameSetup: print("------------------------- Deploy External-Name-Example -----------------------------------") ingress_name = create_ingress_from_yaml(kube_apis.extensions_v1_beta1, test_namespace, f"{TEST_DATA}/externalname-services/externalname-ingress.yaml") @@ -43,7 +46,8 @@ def external_name_setup(request, kube_apis, ingress_controller_prerequisites, in replace_configmap_from_yaml(kube_apis.v1, config_map_name, ingress_controller_prerequisites.namespace, f"{TEST_DATA}/externalname-services/nginx-config.yaml") - svc_name = create_service_from_yaml(kube_apis.v1, test_namespace, f"{TEST_DATA}/externalname-services/externalname-svc.yaml") + svc_name = create_service_from_yaml(kube_apis.v1, + test_namespace, f"{TEST_DATA}/externalname-services/externalname-svc.yaml") ensure_connection_to_public_endpoint(ingress_controller_endpoint.public_ip, ingress_controller_endpoint.port, ingress_controller_endpoint.port_ssl) @@ -51,13 +55,16 @@ def external_name_setup(request, kube_apis, ingress_controller_prerequisites, in def fin(): print("Clean up External-Name-Example:") - replace_configmap(kube_apis.v1, config_map_name, ingress_controller_prerequisites.namespace, ingress_controller_prerequisites.config_map) + replace_configmap(kube_apis.v1, config_map_name, + ingress_controller_prerequisites.namespace, + ingress_controller_prerequisites.config_map) delete_ingress(kube_apis.extensions_v1_beta1, ingress_name, test_namespace) delete_service(kube_apis.v1, svc_name, test_namespace) request.addfinalizer(fin) - return ExternalNameSetup(ingress_controller_endpoint, ingress_name, ingress_host, ic_pod_name, svc_name, external_host, test_namespace) + return ExternalNameSetup(ingress_controller_endpoint, + ingress_name, ingress_host, ic_pod_name, svc_name, external_host, test_namespace) @pytest.mark.skip_for_nginx_oss @@ -68,7 +75,8 @@ def test_resolver(self, external_name_setup): resp = requests.get(req_url, headers={"host": external_name_setup.ingress_host}, verify=False) assert resp.status_code == 502 - def test_ic_template_config_upstream_zone(self, kube_apis, ingress_controller_prerequisites, ingress_controller, external_name_setup): + def test_ic_template_config_upstream_zone(self, kube_apis, ingress_controller_prerequisites, + ingress_controller, external_name_setup): result_conf = get_ingress_nginx_template_conf(kube_apis.v1, external_name_setup.namespace, external_name_setup.ingress_name, @@ -77,7 +85,8 @@ def test_ic_template_config_upstream_zone(self, kube_apis, ingress_controller_pr line = f"zone {external_name_setup.namespace}-{external_name_setup.ingress_name}-{external_name_setup.ingress_host}-{external_name_setup.service}-80 256k;" assert line in result_conf - def test_ic_template_config_upstream_rule(self, kube_apis, ingress_controller_prerequisites, ingress_controller, external_name_setup): + def test_ic_template_config_upstream_rule(self, kube_apis, ingress_controller_prerequisites, + ingress_controller, external_name_setup): result_conf = get_ingress_nginx_template_conf(kube_apis.v1, external_name_setup.namespace, external_name_setup.ingress_name, @@ -85,7 +94,8 @@ def test_ic_template_config_upstream_rule(self, kube_apis, ingress_controller_pr ingress_controller_prerequisites.namespace) assert "random two least_conn;" in result_conf - def test_ic_template_config_upstream_server(self, kube_apis, ingress_controller_prerequisites, ingress_controller, ingress_controller_endpoint, external_name_setup): + def test_ic_template_config_upstream_server(self, kube_apis, ingress_controller_prerequisites, + ingress_controller, ingress_controller_endpoint, external_name_setup): result_conf = get_ingress_nginx_template_conf(kube_apis.v1, external_name_setup.namespace, external_name_setup.ingress_name, diff --git a/tests/suite/test_jwt_auth_mergeable.py b/tests/suite/test_jwt_auth_mergeable.py index 9c52b161b3..707ea38c39 100644 --- a/tests/suite/test_jwt_auth_mergeable.py +++ b/tests/suite/test_jwt_auth_mergeable.py @@ -56,7 +56,7 @@ def fin(): delete_secret(kube_apis.v1, minion_secret_name, test_namespace) print("Clean up the JWT Auth Mergeable Minions Application:") - delete_common_app(kube_apis.v1, kube_apis.extensions_v1_beta1, common_app, test_namespace) + delete_common_app(kube_apis.v1, kube_apis.apps_v1_api, common_app, test_namespace) delete_items_from_yaml(kube_apis, f"{TEST_DATA}/jwt-auth-mergeable/mergeable/jwt-auth-ingress.yaml", test_namespace) diff --git a/tests/suite/test_jwt_secrets.py b/tests/suite/test_jwt_secrets.py index 3e134d50ba..312ecdc484 100644 --- a/tests/suite/test_jwt_secrets.py +++ b/tests/suite/test_jwt_secrets.py @@ -50,7 +50,7 @@ def jwt_secrets_setup(request, kube_apis, ingress_controller_endpoint, ingress_c def fin(): print("Clean up the JWT Secrets Application:") - delete_common_app(kube_apis.v1, kube_apis.extensions_v1_beta1, common_app, test_namespace) + delete_common_app(kube_apis.v1, kube_apis.apps_v1_api, common_app, test_namespace) delete_items_from_yaml(kube_apis, f"{TEST_DATA}/jwt-secrets/{request.param}/jwt-secrets-ingress.yaml", test_namespace) diff --git a/tests/suite/test_smoke.py b/tests/suite/test_smoke.py index e0097e9226..5de6703e3f 100644 --- a/tests/suite/test_smoke.py +++ b/tests/suite/test_smoke.py @@ -39,7 +39,7 @@ def smoke_setup(request, kube_apis, ingress_controller_endpoint, ingress_control def fin(): print("Clean up the Smoke Application:") - delete_common_app(kube_apis.v1, kube_apis.extensions_v1_beta1, common_app, test_namespace) + delete_common_app(kube_apis.v1, kube_apis.apps_v1_api, common_app, test_namespace) delete_items_from_yaml(kube_apis, f"{TEST_DATA}/smoke/{request.param}/smoke-ingress.yaml", test_namespace) delete_secret(kube_apis.v1, secret_name, test_namespace) diff --git a/tests/suite/test_v_s_route.py b/tests/suite/test_v_s_route.py index 57cfece348..9bc4c4c2dc 100644 --- a/tests/suite/test_v_s_route.py +++ b/tests/suite/test_v_s_route.py @@ -30,15 +30,15 @@ def example_app_setup(request, kube_apis, v_s_route_setup) -> None: print("---------------------- Deploy a VS Route Example Application ----------------------------") svc_one = create_service_with_name(kube_apis.v1, v_s_route_setup.route_m.namespace, "backend1-svc") svc_three = create_service_with_name(kube_apis.v1, v_s_route_setup.route_m.namespace, "backend3-svc") - deployment_one = create_deployment_with_name(kube_apis.extensions_v1_beta1, + deployment_one = create_deployment_with_name(kube_apis.apps_v1_api, v_s_route_setup.route_m.namespace, "backend1") - deployment_three = create_deployment_with_name(kube_apis.extensions_v1_beta1, + deployment_three = create_deployment_with_name(kube_apis.apps_v1_api, v_s_route_setup.route_m.namespace, "backend3") svc_two = create_service_with_name(kube_apis.v1, v_s_route_setup.route_s.namespace, "backend2-svc") - deployment_two = create_deployment_with_name(kube_apis.extensions_v1_beta1, + deployment_two = create_deployment_with_name(kube_apis.apps_v1_api, v_s_route_setup.route_s.namespace, "backend2") wait_until_all_pods_are_ready(kube_apis.v1, v_s_route_setup.route_m.namespace) @@ -47,11 +47,11 @@ def example_app_setup(request, kube_apis, v_s_route_setup) -> None: def fin(): print("Clean up the Application:") - delete_deployment(kube_apis.extensions_v1_beta1, deployment_one, v_s_route_setup.route_m.namespace) + delete_deployment(kube_apis.apps_v1_api, deployment_one, v_s_route_setup.route_m.namespace) delete_service(kube_apis.v1, svc_one, v_s_route_setup.route_m.namespace) - delete_deployment(kube_apis.extensions_v1_beta1, deployment_three, v_s_route_setup.route_m.namespace) + delete_deployment(kube_apis.apps_v1_api, deployment_three, v_s_route_setup.route_m.namespace) delete_service(kube_apis.v1, svc_three, v_s_route_setup.route_m.namespace) - delete_deployment(kube_apis.extensions_v1_beta1, deployment_two, v_s_route_setup.route_s.namespace) + delete_deployment(kube_apis.apps_v1_api, deployment_two, v_s_route_setup.route_s.namespace) delete_service(kube_apis.v1, svc_two, v_s_route_setup.route_s.namespace) request.addfinalizer(fin) diff --git a/tests/suite/test_wildcard_tls_secret.py b/tests/suite/test_wildcard_tls_secret.py index 4e6adf9cbe..781fcde41a 100644 --- a/tests/suite/test_wildcard_tls_secret.py +++ b/tests/suite/test_wildcard_tls_secret.py @@ -53,7 +53,7 @@ def fin(): delete_items_from_yaml(kube_apis, f"{TEST_DATA}/wildcard-tls-secret/{ing_type}/wildcard-secret-ingress.yaml", test_namespace) - delete_common_app(kube_apis.v1, kube_apis.extensions_v1_beta1, common_app, test_namespace) + delete_common_app(kube_apis.v1, kube_apis.apps_v1_api, common_app, test_namespace) request.addfinalizer(fin) @@ -77,14 +77,14 @@ def wildcard_tls_secret_ingress_controller(cli_arguments, kube_apis, ingress_con secret_name = create_secret_from_yaml(kube_apis.v1, namespace, f"{TEST_DATA}/wildcard-tls-secret/wildcard-tls-secret.yaml") extra_args = [f"-wildcard-tls-secret={namespace}/{secret_name}"] - name = create_ingress_controller(kube_apis.v1, kube_apis.extensions_v1_beta1, cli_arguments, namespace, extra_args) + name = create_ingress_controller(kube_apis.v1, kube_apis.apps_v1_api, cli_arguments, namespace, extra_args) ensure_connection_to_public_endpoint(wildcard_tls_secret_setup.public_endpoint.public_ip, wildcard_tls_secret_setup.public_endpoint.port, wildcard_tls_secret_setup.public_endpoint.port_ssl) def fin(): print("Remove IC and wildcard secret:") - delete_ingress_controller(kube_apis.extensions_v1_beta1, name, cli_arguments['deployment-type'], namespace) + delete_ingress_controller(kube_apis.apps_v1_api, name, cli_arguments['deployment-type'], namespace) if is_secret_present(kube_apis.v1, secret_name, namespace): delete_secret(kube_apis.v1, secret_name, namespace)