@@ -121,7 +121,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
121
121
if self._job_submission_client:
122
122
return self._job_submission_client
123
123
if is_openshift_cluster():
124
- print(k8client.configuration.get_api_key_with_prefix("authorization"))
125
124
self._job_submission_client = JobSubmissionClient(
126
125
self.cluster_dashboard_uri(),
127
126
headers=self._client_headers,
@@ -212,7 +211,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
212
211
mcad = self.config.mcad
213
212
instance_types = self.config.machine_types
214
213
env = self.config.envs
215
- local_interactive = self.config.local_interactive
216
214
image_pull_secrets = self.config.image_pull_secrets
217
215
dispatch_priority = self.config.dispatch_priority
218
216
write_to_file = self.config.write_to_file
@@ -236,7 +234,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
236
234
mcad=mcad,
237
235
instance_types=instance_types,
238
236
env=env,
239
- local_interactive=local_interactive,
240
237
image_pull_secrets=image_pull_secrets,
241
238
dispatch_priority=dispatch_priority,
242
239
priority_val=priority_val,
@@ -512,13 +509,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
512
509
verify_tls=True,
513
510
):
514
511
config_check()
515
- if (
516
- rc["metadata"]["annotations"]["sdk.codeflare.dev/local_interactive"]
517
- == "True"
518
- ):
519
- local_interactive = True
520
- else:
521
- local_interactive = False
522
512
machine_types = (
523
513
rc["metadata"]["labels"]["orderedinstance"].split("_")
524
514
if "orderedinstance" in rc["metadata"]["labels"]
@@ -559,26 +549,34 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
559
549
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
560
550
0
561
551
]["image"],
562
- local_interactive=local_interactive,
563
552
mcad=mcad,
564
553
write_to_file=write_to_file,
565
554
verify_tls=verify_tls,
566
555
)
567
556
return Cluster(cluster_config)
568
557
569
558
def local_client_url(self):
570
- if self.config.local_interactive == True:
571
- ingress_domain = _get_ingress_domain(self)
572
- return f"ray://{ingress_domain}"
573
- else:
574
- return "None"
559
+ ingress_domain = _get_ingress_domain(self)
560
+ return f"ray://{ingress_domain}"
575
561
576
562
def _component_resources_up(
577
563
self, namespace: str, api_instance: client.CustomObjectsApi
578
564
):
579
565
if self.config.write_to_file:
580
566
with open(self.app_wrapper_yaml) as f:
581
- yamls = yaml.load_all(f, Loader=yaml.FullLoader)
567
+ yamls = list(yaml.load_all(f, Loader=yaml.FullLoader))
568
+ for resource in yamls:
569
+ enable_ingress = (
570
+ resource.get("spec", {})
571
+ .get("headGroupSpec", {})
572
+ .get("enableIngress")
573
+ )
574
+ if resource["kind"] == "RayCluster" and enable_ingress is not False:
575
+ name = resource["metadata"]["name"]
576
+ print(
577
+ f"Forbidden: RayCluster '{name}' has 'enableIngress' set to 'True' or is unset."
578
+ )
579
+ return
582
580
_create_resources(yamls, namespace, api_instance)
583
581
else:
584
582
yamls = yaml.load_all(self.app_wrapper_yaml, Loader=yaml.FullLoader)
@@ -699,13 +697,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
699
697
plural="rayclusters",
700
698
name=name,
701
699
)
702
- elif resource["kind"] == "Secret":
703
- name = resource["metadata"]["name"]
704
- secret_instance = client.CoreV1Api(api_config_handler())
705
- secret_instance.delete_namespaced_secret(
706
- namespace=namespace,
707
- name=name,
708
- )
709
700
710
701
711
702
def _create_resources(yamls, namespace: str, api_instance: client.CustomObjectsApi):
@@ -718,12 +709,6 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
718
709
plural="rayclusters",
719
710
body=resource,
720
711
)
721
- elif resource["kind"] == "Secret":
722
- secret_instance = client.CoreV1Api(api_config_handler())
723
- secret_instance.create_namespaced_secret(
724
- namespace=namespace,
725
- body=resource,
726
- )
727
712
728
713
729
714
def _check_aw_exists(name: str, namespace: str) -> bool:
@@ -1185,7 +1170,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1185
1170
if self._job_submission_client:
1186
1171
return self._job_submission_client
1187
1172
if is_openshift_cluster():
1188
- print(k8client.configuration.get_api_key_with_prefix("authorization"))
1189
1173
self._job_submission_client = JobSubmissionClient(
1190
1174
self.cluster_dashboard_uri(),
1191
1175
headers=self._client_headers,
@@ -1276,7 +1260,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1276
1260
mcad = self.config.mcad
1277
1261
instance_types = self.config.machine_types
1278
1262
env = self.config.envs
1279
- local_interactive = self.config.local_interactive
1280
1263
image_pull_secrets = self.config.image_pull_secrets
1281
1264
dispatch_priority = self.config.dispatch_priority
1282
1265
write_to_file = self.config.write_to_file
@@ -1300,7 +1283,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1300
1283
mcad=mcad,
1301
1284
instance_types=instance_types,
1302
1285
env=env,
1303
- local_interactive=local_interactive,
1304
1286
image_pull_secrets=image_pull_secrets,
1305
1287
dispatch_priority=dispatch_priority,
1306
1288
priority_val=priority_val,
@@ -1576,13 +1558,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1576
1558
verify_tls=True,
1577
1559
):
1578
1560
config_check()
1579
- if (
1580
- rc["metadata"]["annotations"]["sdk.codeflare.dev/local_interactive"]
1581
- == "True"
1582
- ):
1583
- local_interactive = True
1584
- else:
1585
- local_interactive = False
1586
1561
machine_types = (
1587
1562
rc["metadata"]["labels"]["orderedinstance"].split("_")
1588
1563
if "orderedinstance" in rc["metadata"]["labels"]
@@ -1623,26 +1598,34 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1623
1598
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
1624
1599
0
1625
1600
]["image"],
1626
- local_interactive=local_interactive,
1627
1601
mcad=mcad,
1628
1602
write_to_file=write_to_file,
1629
1603
verify_tls=verify_tls,
1630
1604
)
1631
1605
return Cluster(cluster_config)
1632
1606
1633
1607
def local_client_url(self):
1634
- if self.config.local_interactive == True:
1635
- ingress_domain = _get_ingress_domain(self)
1636
- return f"ray://{ingress_domain}"
1637
- else:
1638
- return "None"
1608
+ ingress_domain = _get_ingress_domain(self)
1609
+ return f"ray://{ingress_domain}"
1639
1610
1640
1611
def _component_resources_up(
1641
1612
self, namespace: str, api_instance: client.CustomObjectsApi
1642
1613
):
1643
1614
if self.config.write_to_file:
1644
1615
with open(self.app_wrapper_yaml) as f:
1645
- yamls = yaml.load_all(f, Loader=yaml.FullLoader)
1616
+ yamls = list(yaml.load_all(f, Loader=yaml.FullLoader))
1617
+ for resource in yamls:
1618
+ enable_ingress = (
1619
+ resource.get("spec", {})
1620
+ .get("headGroupSpec", {})
1621
+ .get("enableIngress")
1622
+ )
1623
+ if resource["kind"] == "RayCluster" and enable_ingress is not False:
1624
+ name = resource["metadata"]["name"]
1625
+ print(
1626
+ f"Forbidden: RayCluster '{name}' has 'enableIngress' set to 'True' or is unset."
1627
+ )
1628
+ return
1646
1629
_create_resources(yamls, namespace, api_instance)
1647
1630
else:
1648
1631
yamls = yaml.load_all(self.app_wrapper_yaml, Loader=yaml.FullLoader)
@@ -1675,7 +1658,6 @@ <h3>Instance variables</h3>
1675
1658
if self._job_submission_client:
1676
1659
return self._job_submission_client
1677
1660
if is_openshift_cluster():
1678
- print(k8client.configuration.get_api_key_with_prefix("authorization"))
1679
1661
self._job_submission_client = JobSubmissionClient(
1680
1662
self.cluster_dashboard_uri(),
1681
1663
headers=self._client_headers,
@@ -1824,7 +1806,6 @@ <h3>Methods</h3>
1824
1806
mcad = self.config.mcad
1825
1807
instance_types = self.config.machine_types
1826
1808
env = self.config.envs
1827
- local_interactive = self.config.local_interactive
1828
1809
image_pull_secrets = self.config.image_pull_secrets
1829
1810
dispatch_priority = self.config.dispatch_priority
1830
1811
write_to_file = self.config.write_to_file
@@ -1848,7 +1829,6 @@ <h3>Methods</h3>
1848
1829
mcad=mcad,
1849
1830
instance_types=instance_types,
1850
1831
env=env,
1851
- local_interactive=local_interactive,
1852
1832
image_pull_secrets=image_pull_secrets,
1853
1833
dispatch_priority=dispatch_priority,
1854
1834
priority_val=priority_val,
@@ -1953,13 +1933,6 @@ <h3>Methods</h3>
1953
1933
verify_tls=True,
1954
1934
):
1955
1935
config_check()
1956
- if (
1957
- rc["metadata"]["annotations"]["sdk.codeflare.dev/local_interactive"]
1958
- == "True"
1959
- ):
1960
- local_interactive = True
1961
- else:
1962
- local_interactive = False
1963
1936
machine_types = (
1964
1937
rc["metadata"]["labels"]["orderedinstance"].split("_")
1965
1938
if "orderedinstance" in rc["metadata"]["labels"]
@@ -2000,7 +1973,6 @@ <h3>Methods</h3>
2000
1973
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
2001
1974
0
2002
1975
]["image"],
2003
- local_interactive=local_interactive,
2004
1976
mcad=mcad,
2005
1977
write_to_file=write_to_file,
2006
1978
verify_tls=verify_tls,
@@ -2092,11 +2064,8 @@ <h3>Methods</h3>
2092
2064
< span > Expand source code</ span >
2093
2065
</ summary >
2094
2066
< pre > < code class ="python "> def local_client_url(self):
2095
- if self.config.local_interactive == True:
2096
- ingress_domain = _get_ingress_domain(self)
2097
- return f"ray://{ingress_domain}"
2098
- else:
2099
- return "None"</ code > </ pre >
2067
+ ingress_domain = _get_ingress_domain(self)
2068
+ return f"ray://{ingress_domain}"</ code > </ pre >
2100
2069
</ details >
2101
2070
</ dd >
2102
2071
< dt id ="codeflare_sdk.cluster.cluster.Cluster.status "> < code class ="name flex ">
0 commit comments