@@ -589,7 +589,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
589589 if resource["kind"] == "RayCluster":
590590 api_instance.create_namespaced_custom_object(
591591 group="ray.io",
592- version="v1alpha1 ",
592+ version="v1 ",
593593 namespace=namespace,
594594 plural="rayclusters",
595595 body=resource,
@@ -626,7 +626,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
626626 if resource["kind"] == "RayCluster":
627627 api_instance.delete_namespaced_custom_object(
628628 group="ray.io",
629- version="v1alpha1 ",
629+ version="v1 ",
630630 namespace=namespace,
631631 plural="rayclusters",
632632 name=self.app_wrapper_name,
@@ -713,7 +713,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
713713 api_instance = client.CustomObjectsApi(api_config_handler())
714714 rcs = api_instance.list_namespaced_custom_object(
715715 group="ray.io",
716- version="v1alpha1 ",
716+ version="v1 ",
717717 namespace=namespace,
718718 plural="rayclusters",
719719 )
@@ -870,7 +870,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
870870 api_instance = client.CustomObjectsApi(api_config_handler())
871871 rcs = api_instance.list_namespaced_custom_object(
872872 group="ray.io",
873- version="v1alpha1 ",
873+ version="v1 ",
874874 namespace=namespace,
875875 plural="rayclusters",
876876 )
@@ -890,7 +890,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
890890 api_instance = client.CustomObjectsApi(api_config_handler())
891891 rcs = api_instance.list_namespaced_custom_object(
892892 group="ray.io",
893- version="v1alpha1 ",
893+ version="v1 ",
894894 namespace=namespace,
895895 plural="rayclusters",
896896 )
@@ -934,25 +934,47 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
934934 status = RayClusterStatus(rc["status"]["state"].lower())
935935 else:
936936 status = RayClusterStatus.UNKNOWN
937- try:
938- config_check()
939- api_instance = client.NetworkingV1Api(api_config_handler())
940- ingresses = api_instance.list_namespaced_ingress(rc["metadata"]["namespace"])
941- except Exception as e: # pragma no cover
942- return _kube_api_error_handling(e)
943- ray_ingress = None
944- for ingress in ingresses.items:
945- annotations = ingress.metadata.annotations
946- protocol = "http"
947- if (
948- ingress.metadata.name == f"ray-dashboard-{rc['metadata']['name']}"
949- or ingress.metadata.name.startswith(f"{rc['metadata']['name']}-ingress")
950- ):
951- if annotations == None:
952- protocol = "http"
953- elif "route.openshift.io/termination" in annotations:
954- protocol = "https"
955- ray_ingress = f"{protocol}://{ingress.spec.rules[0].host}"
937+ config_check()
938+ dashboard_url = None
939+ if is_openshift_cluster():
940+ try:
941+ api_instance = client.CustomObjectsApi(api_config_handler())
942+ routes = api_instance.list_namespaced_custom_object(
943+ group="route.openshift.io",
944+ version="v1",
945+ namespace=rc["metadata"]["namespace"],
946+ plural="routes",
947+ )
948+ except Exception as e: # pragma: no cover
949+ return _kube_api_error_handling(e)
950+
951+ for route in routes["items"]:
952+ rc_name = rc["metadata"]["name"]
953+ if route["metadata"]["name"] == f"ray-dashboard-{rc_name}" or route[
954+ "metadata"
955+ ]["name"].startswith(f"{rc_name}-ingress"):
956+ protocol = "https" if route["spec"].get("tls") else "http"
957+ dashboard_url = f"{protocol}://{route['spec']['host']}"
958+ else:
959+ try:
960+ api_instance = client.NetworkingV1Api(api_config_handler())
961+ ingresses = api_instance.list_namespaced_ingress(
962+ rc["metadata"]["namespace"]
963+ )
964+ except Exception as e: # pragma no cover
965+ return _kube_api_error_handling(e)
966+ for ingress in ingresses.items:
967+ annotations = ingress.metadata.annotations
968+ protocol = "http"
969+ if (
970+ ingress.metadata.name == f"ray-dashboard-{rc['metadata']['name']}"
971+ or ingress.metadata.name.startswith(f"{rc['metadata']['name']}-ingress")
972+ ):
973+ if annotations == None:
974+ protocol = "http"
975+ elif "route.openshift.io/termination" in annotations:
976+ protocol = "https"
977+ dashboard_url = f"{protocol}://{ingress.spec.rules[0].host}"
956978
957979 return RayCluster(
958980 name=rc["metadata"]["name"],
@@ -979,7 +1001,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
9791001 head_gpu=rc["spec"]["headGroupSpec"]["template"]["spec"]["containers"][0][
9801002 "resources"
9811003 ]["limits"]["nvidia.com/gpu"],
982- dashboard=ray_ingress ,
1004+ dashboard=dashboard_url ,
9831005 )
9841006
9851007
@@ -1068,7 +1090,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
10681090 api_instance = client.CustomObjectsApi(api_config_handler())
10691091 rcs = api_instance.list_namespaced_custom_object(
10701092 group="ray.io",
1071- version="v1alpha1 ",
1093+ version="v1 ",
10721094 namespace=namespace,
10731095 plural="rayclusters",
10741096 )
@@ -1777,7 +1799,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
17771799 if resource["kind"] == "RayCluster":
17781800 api_instance.create_namespaced_custom_object(
17791801 group="ray.io",
1780- version="v1alpha1 ",
1802+ version="v1 ",
17811803 namespace=namespace,
17821804 plural="rayclusters",
17831805 body=resource,
@@ -1814,7 +1836,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
18141836 if resource["kind"] == "RayCluster":
18151837 api_instance.delete_namespaced_custom_object(
18161838 group="ray.io",
1817- version="v1alpha1 ",
1839+ version="v1 ",
18181840 namespace=namespace,
18191841 plural="rayclusters",
18201842 name=self.app_wrapper_name,
0 commit comments