Skip to content

Commit 2a85469

Browse files
Updated image parameter to be optional
1 parent 1ab5421 commit 2a85469

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

src/codeflare_sdk/cluster/cluster.py

-13
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,6 @@ def job_client(self):
103103
)
104104
return self._job_submission_client
105105

106-
def validate_image_config(self):
107-
"""
108-
Validates that the image configuration is not empty.
109-
110-
:param image: The image string to validate
111-
:raises ValueError: If the image is not specified
112-
"""
113-
if self.config.image == "" or self.config.image == None:
114-
raise ValueError("Image must be specified in the ClusterConfiguration")
115-
116106
def create_app_wrapper(self):
117107
"""
118108
Called upon cluster object creation, creates an AppWrapper yaml based on
@@ -128,9 +118,6 @@ def create_app_wrapper(self):
128118
f"Namespace {self.config.namespace} is of type {type(self.config.namespace)}. Check your Kubernetes Authentication."
129119
)
130120

131-
# Validate image configuration
132-
self.validate_image_config()
133-
134121
# Before attempting to create the cluster AW, let's evaluate the ClusterConfig
135122

136123
name = self.config.name

src/codeflare_sdk/utils/generate_yaml.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def update_names(cluster_yaml, cluster_name, namespace):
8686

8787
def update_image(spec, image):
8888
containers = spec.get("containers")
89-
for container in containers:
90-
container["image"] = image
89+
if image != "":
90+
for container in containers:
91+
container["image"] = image
9192

9293

9394
def update_image_pull_secrets(spec, image_pull_secrets):

tests/unit_test.py

-13
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,6 @@ def test_cluster_no_kueue_no_aw(mocker):
307307
)
308308

309309

310-
def test_create_app_wrapper_raises_error_with_no_image():
311-
config = createClusterConfig()
312-
config.image = "" # Clear the image to test error handling
313-
try:
314-
cluster = Cluster(config)
315-
cluster.create_app_wrapper()
316-
assert False, "Expected ValueError when 'image' is not specified."
317-
except ValueError as error:
318-
assert (
319-
str(error) == "Image must be specified in the ClusterConfiguration"
320-
), "Error message did not match expected output."
321-
322-
323310
def get_local_queue(group, version, namespace, plural):
324311
assert group == "kueue.x-k8s.io"
325312
assert version == "v1beta1"

0 commit comments

Comments
 (0)