Skip to content

Commit

Permalink
Updated image parameter to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 authored and openshift-merge-bot[bot] committed Jul 9, 2024
1 parent 1ab5421 commit 2a85469
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
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

0 comments on commit 2a85469

Please sign in to comment.