Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kuadrant namespace annotation to gateway #238

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions testsuite/openshift/objects/gateway_api/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ def create_instance(
name: str,
gateway_class: str,
hostname: str,
kuadrant_namespace: str,
labels: dict[str, str] = None,
):
"""Creates new instance of Gateway"""

model = {
"apiVersion": "gateway.networking.k8s.io/v1beta1",
"kind": "Gateway",
"metadata": {"name": name, "labels": labels},
"metadata": {
"name": name,
"labels": labels,
"annotations": {"kuadrant.io/namespace": kuadrant_namespace},
},
"spec": {
"gatewayClassName": gateway_class,
"listeners": [
Expand Down Expand Up @@ -83,6 +88,7 @@ def create_instance(
name: str,
gateway_class: str,
hostname: str,
kuadrant_namespace: str,
labels: dict[str, str] = None,
placement: typing.Optional[str] = None,
):
Expand All @@ -93,7 +99,9 @@ def create_instance(
if placement is not None:
labels["cluster.open-cluster-management.io/placement"] = placement

return super(MGCGateway, cls).create_instance(openshift, name, gateway_class, hostname, labels)
return super(MGCGateway, cls).create_instance(
openshift, name, gateway_class, hostname, kuadrant_namespace, labels
)

def get_spoke_gateway(self, spokes: dict[str, OpenShiftClient]) -> "MGCGateway":
"""
Expand Down
6 changes: 4 additions & 2 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,11 @@ def backend(request, openshift, blame, label):


@pytest.fixture(scope="module")
def gateway(request, openshift, blame, wildcard_domain, module_label) -> Gateway:
def gateway(request, openshift, blame, wildcard_domain, module_label, testconfig) -> Gateway:
"""Gateway object to use when working with Gateway API"""
gateway = Gateway.create_instance(openshift, blame("gw"), "istio", wildcard_domain, {"app": module_label})
gateway = Gateway.create_instance(
openshift, blame("gw"), "istio", wildcard_domain, testconfig["kuadrant"]["project"], {"app": module_label}
)
request.addfinalizer(gateway.delete)
gateway.commit()
gateway.wait_for_ready()
Expand Down
3 changes: 2 additions & 1 deletion testsuite/tests/mgc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ def spokes(testconfig):


@pytest.fixture(scope="module")
def upstream_gateway(request, openshift, blame, hostname, module_label):
def upstream_gateway(request, openshift, blame, hostname, module_label, testconfig):
"""Creates and returns configured and ready upstream Gateway"""
upstream_gateway = MGCGateway.create_instance(
openshift=openshift,
name=blame("mgc-gateway"),
gateway_class="kuadrant-multi-cluster-gateway-instance-per-cluster",
hostname=f"*.{hostname}",
placement="http-gateway",
kuadrant_namespace=testconfig["kuadrant"]["project"],
labels={"app": module_label},
)
request.addfinalizer(upstream_gateway.delete)
Expand Down