-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #347 from pehala/unite_exposers
Unify exposers
- Loading branch information
Showing
14 changed files
with
154 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Translates string to an Exposer class that can initialized""" | ||
|
||
from testsuite.gateway.exposers import OpenShiftExposer | ||
|
||
EXPOSERS = {"openshift": OpenShiftExposer} | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def load(obj, env=None, silent=True, key=None, filename=None): | ||
"""Selects proper Exposes class""" | ||
try: | ||
obj["default_exposer"] = EXPOSERS[obj["default_exposer"]] | ||
except KeyError: | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""General exposers, not tied to Envoy or Gateway API""" | ||
|
||
from testsuite.gateway import Exposer, Gateway, Hostname | ||
from testsuite.openshift.route import OpenshiftRoute | ||
|
||
|
||
class OpenShiftExposer(Exposer): | ||
"""Exposes hostnames through OpenShift Route objects""" | ||
|
||
def __init__(self, openshift) -> None: | ||
super().__init__(openshift) | ||
self.routes: list[OpenshiftRoute] = [] | ||
|
||
@property | ||
def base_domain(self) -> str: | ||
return self.openshift.apps_url | ||
|
||
def expose_hostname(self, name, gateway: Gateway) -> Hostname: | ||
tls = False | ||
termination = "edge" | ||
if self.passthrough: | ||
tls = True | ||
termination = "passthrough" | ||
route = OpenshiftRoute.create_instance( | ||
gateway.openshift, name, gateway.service_name, "api", tls=tls, termination=termination | ||
) | ||
route.verify = self.verify | ||
self.routes.append(route) | ||
route.commit() | ||
return route | ||
|
||
def commit(self): | ||
return | ||
|
||
def delete(self): | ||
for route in self.routes: | ||
route.delete() | ||
self.routes = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.