Skip to content

Commit 6557465

Browse files
Add enableIngress and set to false by default
1 parent 979ff43 commit 6557465

File tree

6 files changed

+19
-0
lines changed

6 files changed

+19
-0
lines changed

src/codeflare_sdk/cluster/cluster.py

+14
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,20 @@ def _component_resources_up(
547547
if self.config.write_to_file:
548548
with open(self.app_wrapper_yaml) as f:
549549
yamls = yaml.load_all(f, Loader=yaml.FullLoader)
550+
for resource in yamls:
551+
enable_ingress = (
552+
resource.get("spec", {})
553+
.get("headGroupSpec", {})
554+
.get("enableIngress")
555+
)
556+
if resource["kind"] == "RayCluster" and enable_ingress is not False:
557+
name = resource["metadata"]["name"]
558+
print(
559+
f"Forbidden: RayCluster '{name}' has 'enableIngress' set to 'True' or is unset."
560+
)
561+
return
562+
f.seek(0) # Reset file pointer to the beginning
563+
yamls = yaml.load_all(f, Loader=yaml.FullLoader) # Reload the YAMLs
550564
_create_resources(yamls, namespace, api_instance)
551565
else:
552566
yamls = yaml.load_all(self.app_wrapper_yaml, Loader=yaml.FullLoader)

src/codeflare_sdk/templates/base-template.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ spec:
8787
headGroupSpec:
8888
# Kubernetes Service Type, valid values are 'ClusterIP', 'NodePort' and 'LoadBalancer'
8989
serviceType: ClusterIP
90+
enableIngress: false
9091
# logical group name, for this called head-group, also can be functional
9192
# pod type head or worker
9293
# rayNodeType: head # Not needed since it is under the headgroup

tests/test-case-no-mcad.yamls

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
upscalingMode: Default
2424
enableInTreeAutoscaling: false
2525
headGroupSpec:
26+
enableIngress: false
2627
rayStartParams:
2728
block: 'true'
2829
dashboard-host: 0.0.0.0

tests/test-case-prio.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ spec:
5353
upscalingMode: Default
5454
enableInTreeAutoscaling: false
5555
headGroupSpec:
56+
enableIngress: false
5657
rayStartParams:
5758
block: 'true'
5859
dashboard-host: 0.0.0.0

tests/test-case.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ spec:
5252
upscalingMode: Default
5353
enableInTreeAutoscaling: false
5454
headGroupSpec:
55+
enableIngress: false
5556
rayStartParams:
5657
block: 'true'
5758
dashboard-host: 0.0.0.0

tests/test-default-appwrapper.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ spec:
5050
upscalingMode: Default
5151
enableInTreeAutoscaling: false
5252
headGroupSpec:
53+
enableIngress: false
5354
rayStartParams:
5455
block: 'true'
5556
dashboard-host: 0.0.0.0

0 commit comments

Comments
 (0)