diff --git a/src/codeflare_sdk/cluster/cluster.py b/src/codeflare_sdk/cluster/cluster.py index b823cfd54..78bc666cf 100644 --- a/src/codeflare_sdk/cluster/cluster.py +++ b/src/codeflare_sdk/cluster/cluster.py @@ -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 @@ -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 diff --git a/src/codeflare_sdk/utils/generate_yaml.py b/src/codeflare_sdk/utils/generate_yaml.py index 3e692480e..cde49ed32 100755 --- a/src/codeflare_sdk/utils/generate_yaml.py +++ b/src/codeflare_sdk/utils/generate_yaml.py @@ -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): diff --git a/tests/unit_test.py b/tests/unit_test.py index ca6cb9584..3daba3a19 100644 --- a/tests/unit_test.py +++ b/tests/unit_test.py @@ -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"