@@ -589,7 +589,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
589
589
if resource["kind"] == "RayCluster":
590
590
api_instance.create_namespaced_custom_object(
591
591
group="ray.io",
592
- version="v1alpha1 ",
592
+ version="v1 ",
593
593
namespace=namespace,
594
594
plural="rayclusters",
595
595
body=resource,
@@ -626,7 +626,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
626
626
if resource["kind"] == "RayCluster":
627
627
api_instance.delete_namespaced_custom_object(
628
628
group="ray.io",
629
- version="v1alpha1 ",
629
+ version="v1 ",
630
630
namespace=namespace,
631
631
plural="rayclusters",
632
632
name=self.app_wrapper_name,
@@ -713,7 +713,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
713
713
api_instance = client.CustomObjectsApi(api_config_handler())
714
714
rcs = api_instance.list_namespaced_custom_object(
715
715
group="ray.io",
716
- version="v1alpha1 ",
716
+ version="v1 ",
717
717
namespace=namespace,
718
718
plural="rayclusters",
719
719
)
@@ -870,7 +870,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
870
870
api_instance = client.CustomObjectsApi(api_config_handler())
871
871
rcs = api_instance.list_namespaced_custom_object(
872
872
group="ray.io",
873
- version="v1alpha1 ",
873
+ version="v1 ",
874
874
namespace=namespace,
875
875
plural="rayclusters",
876
876
)
@@ -890,7 +890,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
890
890
api_instance = client.CustomObjectsApi(api_config_handler())
891
891
rcs = api_instance.list_namespaced_custom_object(
892
892
group="ray.io",
893
- version="v1alpha1 ",
893
+ version="v1 ",
894
894
namespace=namespace,
895
895
plural="rayclusters",
896
896
)
@@ -934,25 +934,47 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
934
934
status = RayClusterStatus(rc["status"]["state"].lower())
935
935
else:
936
936
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}"
956
978
957
979
return RayCluster(
958
980
name=rc["metadata"]["name"],
@@ -979,7 +1001,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
979
1001
head_gpu=rc["spec"]["headGroupSpec"]["template"]["spec"]["containers"][0][
980
1002
"resources"
981
1003
]["limits"]["nvidia.com/gpu"],
982
- dashboard=ray_ingress ,
1004
+ dashboard=dashboard_url ,
983
1005
)
984
1006
985
1007
@@ -1068,7 +1090,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
1068
1090
api_instance = client.CustomObjectsApi(api_config_handler())
1069
1091
rcs = api_instance.list_namespaced_custom_object(
1070
1092
group="ray.io",
1071
- version="v1alpha1 ",
1093
+ version="v1 ",
1072
1094
namespace=namespace,
1073
1095
plural="rayclusters",
1074
1096
)
@@ -1777,7 +1799,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1777
1799
if resource["kind"] == "RayCluster":
1778
1800
api_instance.create_namespaced_custom_object(
1779
1801
group="ray.io",
1780
- version="v1alpha1 ",
1802
+ version="v1 ",
1781
1803
namespace=namespace,
1782
1804
plural="rayclusters",
1783
1805
body=resource,
@@ -1814,7 +1836,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1814
1836
if resource["kind"] == "RayCluster":
1815
1837
api_instance.delete_namespaced_custom_object(
1816
1838
group="ray.io",
1817
- version="v1alpha1 ",
1839
+ version="v1 ",
1818
1840
namespace=namespace,
1819
1841
plural="rayclusters",
1820
1842
name=self.app_wrapper_name,
0 commit comments