From bbb25fe7970e96911b8ec06c3205d23ddd188b0e Mon Sep 17 00:00:00 2001 From: phala Date: Wed, 19 Jun 2024 08:46:17 +0200 Subject: [PATCH] Decide on which Exposer to use automatically --- config/settings.local.yaml.tpl | 2 +- config/settings.yaml | 1 - testsuite/config/exposer.py | 10 +++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config/settings.local.yaml.tpl b/config/settings.local.yaml.tpl index a0b6e60b..54d6ef4b 100644 --- a/config/settings.local.yaml.tpl +++ b/config/settings.local.yaml.tpl @@ -44,7 +44,7 @@ # auth_url: "" # authorization URL for already deployed Authorino # oidc_url: "" # oidc URL for already deployed Authorino # metrics_service_name: "" # controller metrics service name for already deployed Authorino -# default_exposer: "openshift" # Exposer type that should be used, options: 'openshift' +# default_exposer: "kubernetes" # Force Exposer typem options: 'openshift', 'kind', 'kubernetes' # control_plane: # managedzone: aws-mz # Name of the ManagedZone resource # issuer: # Issuer object for testing TLSPolicy diff --git a/config/settings.yaml b/config/settings.yaml index 8865a925..09e3eb19 100644 --- a/config/settings.yaml +++ b/config/settings.yaml @@ -24,7 +24,6 @@ default: hyperfoil: generate_reports: True reports_dir: "reports" - default_exposer: "openshift" control_plane: managedzone: "aws-mz" issuer: diff --git a/testsuite/config/exposer.py b/testsuite/config/exposer.py index a7a6eaff..7f9d63a5 100644 --- a/testsuite/config/exposer.py +++ b/testsuite/config/exposer.py @@ -8,7 +8,11 @@ # pylint: disable=unused-argument def load(obj, env=None, silent=True, key=None, filename=None): """Selects proper Exposes class""" - try: + if "default_exposer" not in obj or not obj["default_exposer"]: + client = obj["cluster"] + if "route.openshift.io/v1" in client.do_action("api-versions").out(): + obj["default_exposer"] = EXPOSERS["openshift"] + else: + obj["default_exposer"] = EXPOSERS["kubernetes"] + else: obj["default_exposer"] = EXPOSERS[obj["default_exposer"]] - except KeyError: - pass