Skip to content

Updated image parameter to be optional #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/codeflare_sdk/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ def job_client(self):
)
return self._job_submission_client

def validate_image_config(self):
"""
Validates that the image configuration is not empty.

:param image: The image string to validate
:raises ValueError: If the image is not specified
"""
if self.config.image == "" or self.config.image == None:
raise ValueError("Image must be specified in the ClusterConfiguration")

def create_app_wrapper(self):
"""
Called upon cluster object creation, creates an AppWrapper yaml based on
Expand All @@ -128,9 +118,6 @@ def create_app_wrapper(self):
f"Namespace {self.config.namespace} is of type {type(self.config.namespace)}. Check your Kubernetes Authentication."
)

# Validate image configuration
self.validate_image_config()

# Before attempting to create the cluster AW, let's evaluate the ClusterConfig

name = self.config.name
Expand Down
5 changes: 3 additions & 2 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def update_names(cluster_yaml, cluster_name, namespace):

def update_image(spec, image):
containers = spec.get("containers")
for container in containers:
container["image"] = image
if image != "":
for container in containers:
container["image"] = image


def update_image_pull_secrets(spec, image_pull_secrets):
Expand Down
13 changes: 0 additions & 13 deletions tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,6 @@ def test_cluster_no_kueue_no_aw(mocker):
)


def test_create_app_wrapper_raises_error_with_no_image():
config = createClusterConfig()
config.image = "" # Clear the image to test error handling
try:
cluster = Cluster(config)
cluster.create_app_wrapper()
assert False, "Expected ValueError when 'image' is not specified."
except ValueError as error:
assert (
str(error) == "Image must be specified in the ClusterConfiguration"
), "Error message did not match expected output."


def get_local_queue(group, version, namespace, plural):
assert group == "kueue.x-k8s.io"
assert version == "v1beta1"
Expand Down