From 5d3dcca1b2e283bf96259e8dc3819247d59d3de2 Mon Sep 17 00:00:00 2001 From: kryanbeane Date: Mon, 12 Jan 2026 11:45:08 +0000 Subject: [PATCH] no-jira: test using gateway config as fallback for constructing dashboard url --- src/codeflare_sdk/ray/cluster/cluster.py | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/codeflare_sdk/ray/cluster/cluster.py b/src/codeflare_sdk/ray/cluster/cluster.py index 3d8cbe216..1393b8043 100644 --- a/src/codeflare_sdk/ray/cluster/cluster.py +++ b/src/codeflare_sdk/ray/cluster/cluster.py @@ -1176,6 +1176,13 @@ def _get_dashboard_url_from_httproute( Get the Ray dashboard URL from an HTTPRoute (RHOAI v3.0+ Gateway API). Searches for HTTPRoute labeled with ray.io/cluster-name and ray.io/cluster-namespace. Returns the dashboard URL if found, or None to allow fallback to Routes/Ingress. + + Hostname resolution order: + 1. Gateway spec.listeners[].hostname + 2. OpenShift Route exposing the Gateway + 3. GatewayConfig CR domain configuration (ODH/RHOAI) + 4. Gateway status.addresses[].value + Args: cluster_name: Ray cluster name namespace: Ray cluster namespace @@ -1283,6 +1290,29 @@ def _get_dashboard_url_from_httproute( except Exception: pass # Continue to next fallback + # If no hostname from Route, try GatewayConfig CR + if not hostname: + try: + # GatewayConfig is a cluster-scoped CR in services.platform.opendatahub.io + gateway_config = api_instance.get_cluster_custom_object( + group="services.platform.opendatahub.io", + version="v1alpha1", + plural="gatewayconfigs", + name="default", + ) + + # Extract subdomain (defaults to "data-science-gateway") + subdomain = gateway_config.get("spec", {}).get("subdomain", "").strip() + if not subdomain: + subdomain = "data-science-gateway" + + # Extract domain from GatewayConfig + domain = gateway_config.get("spec", {}).get("domain", "").strip() + if domain: + hostname = f"{subdomain}.{domain}" + except Exception: + pass + # If still no hostname, try status.addresses (internal address - may only work in-cluster) if not hostname: addresses = gateway.get("status", {}).get("addresses", [])