Skip to content

Commit

Permalink
Make tls in MGC gateway plugable
Browse files Browse the repository at this point in the history
  • Loading branch information
averevki committed Nov 2, 2023
1 parent 37a26c4 commit 98dfb84
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
29 changes: 16 additions & 13 deletions testsuite/openshift/objects/gateway_api/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def create_instance(
gateway_class: str,
hostname: str,
labels: dict[str, str] = None,
tls: bool = False,
placement: typing.Optional[str] = None,
):
"""Creates new instance of Gateway"""
Expand All @@ -95,19 +96,21 @@ def create_instance(
labels["cluster.open-cluster-management.io/placement"] = placement

instance = super(MGCGateway, cls).create_instance(openshift, name, gateway_class, hostname, labels)
instance.model["spec"]["listeners"] = [
{
"name": "api",
"port": 443,
"protocol": "HTTPS",
"hostname": hostname,
"allowedRoutes": {"namespaces": {"from": "All"}},
"tls": {
"mode": "Terminate",
"certificateRefs": [{"name": f"{name}-tls", "kind": "Secret"}],
},
}
]

if tls:
instance.model["spec"]["listeners"] = [
{
"name": "api",
"port": 443,
"protocol": "HTTPS",
"hostname": hostname,
"allowedRoutes": {"namespaces": {"from": "All"}},
"tls": {
"mode": "Terminate",
"certificateRefs": [{"name": f"{name}-tls", "kind": "Secret"}],
},
}
]

return instance

Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/mgc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def upstream_gateway(request, openshift, blame, hostname, module_label):
name=blame("mgc-gateway"),
gateway_class="kuadrant-multi-cluster-gateway-instance-per-cluster",
hostname=f"*.{hostname}",
tls=True,
placement="http-gateway",
labels={"app": module_label},
)
Expand Down

0 comments on commit 98dfb84

Please sign in to comment.