Skip to content

Commit 5d3dcca

Browse files
committed
no-jira: test using gateway config as fallback for constructing dashboard url
1 parent 17485ee commit 5d3dcca

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/codeflare_sdk/ray/cluster/cluster.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,13 @@ def _get_dashboard_url_from_httproute(
11761176
Get the Ray dashboard URL from an HTTPRoute (RHOAI v3.0+ Gateway API).
11771177
Searches for HTTPRoute labeled with ray.io/cluster-name and ray.io/cluster-namespace.
11781178
Returns the dashboard URL if found, or None to allow fallback to Routes/Ingress.
1179+
1180+
Hostname resolution order:
1181+
1. Gateway spec.listeners[].hostname
1182+
2. OpenShift Route exposing the Gateway
1183+
3. GatewayConfig CR domain configuration (ODH/RHOAI)
1184+
4. Gateway status.addresses[].value
1185+
11791186
Args:
11801187
cluster_name: Ray cluster name
11811188
namespace: Ray cluster namespace
@@ -1283,6 +1290,29 @@ def _get_dashboard_url_from_httproute(
12831290
except Exception:
12841291
pass # Continue to next fallback
12851292

1293+
# If no hostname from Route, try GatewayConfig CR
1294+
if not hostname:
1295+
try:
1296+
# GatewayConfig is a cluster-scoped CR in services.platform.opendatahub.io
1297+
gateway_config = api_instance.get_cluster_custom_object(
1298+
group="services.platform.opendatahub.io",
1299+
version="v1alpha1",
1300+
plural="gatewayconfigs",
1301+
name="default",
1302+
)
1303+
1304+
# Extract subdomain (defaults to "data-science-gateway")
1305+
subdomain = gateway_config.get("spec", {}).get("subdomain", "").strip()
1306+
if not subdomain:
1307+
subdomain = "data-science-gateway"
1308+
1309+
# Extract domain from GatewayConfig
1310+
domain = gateway_config.get("spec", {}).get("domain", "").strip()
1311+
if domain:
1312+
hostname = f"{subdomain}.{domain}"
1313+
except Exception:
1314+
pass
1315+
12861316
# If still no hostname, try status.addresses (internal address - may only work in-cluster)
12871317
if not hostname:
12881318
addresses = gateway.get("status", {}).get("addresses", [])

0 commit comments

Comments
 (0)