@@ -250,7 +250,7 @@ def get_pod_spec(cluster: "codeflare_sdk.ray.cluster.Cluster", containers):
250
250
"""
251
251
pod_spec = V1PodSpec (
252
252
containers = containers ,
253
- volumes = VOLUMES ,
253
+ volumes = generate_custom_storage ( cluster . config . volumes , VOLUMES ) ,
254
254
)
255
255
if cluster .config .image_pull_secrets != []:
256
256
pod_spec .image_pull_secrets = generate_image_pull_secrets (cluster )
@@ -296,7 +296,9 @@ def get_head_container_spec(
296
296
cluster .config .head_memory_limits ,
297
297
cluster .config .head_extended_resource_requests ,
298
298
),
299
- volume_mounts = VOLUME_MOUNTS ,
299
+ volume_mounts = generate_custom_storage (
300
+ cluster .config .volume_mounts , VOLUME_MOUNTS
301
+ ),
300
302
)
301
303
if cluster .config .envs != {}:
302
304
head_container .env = generate_env_vars (cluster )
@@ -338,7 +340,9 @@ def get_worker_container_spec(
338
340
cluster .config .worker_memory_limits ,
339
341
cluster .config .worker_extended_resource_requests ,
340
342
),
341
- volume_mounts = VOLUME_MOUNTS ,
343
+ volume_mounts = generate_custom_storage (
344
+ cluster .config .volume_mounts , VOLUME_MOUNTS
345
+ ),
342
346
)
343
347
344
348
if cluster .config .envs != {}:
@@ -522,6 +526,22 @@ def wrap_cluster(
522
526
523
527
524
528
# Etc.
529
+ def generate_custom_storage (provided_storage : list , default_storage : list ):
530
+ """
531
+ The generate_custom_storage function updates the volumes/volume mounts configs with the default volumes/volume mounts.
532
+ """
533
+ storage_list = provided_storage .copy ()
534
+
535
+ if storage_list == []:
536
+ storage_list = default_storage
537
+ else :
538
+ # We append the list of volumes/volume mounts with the defaults and return the full list
539
+ for storage in default_storage :
540
+ storage_list .append (storage )
541
+
542
+ return storage_list
543
+
544
+
525
545
def write_to_file (cluster : "codeflare_sdk.ray.cluster.Cluster" , resource : dict ):
526
546
"""
527
547
The write_to_file function writes the built Ray Cluster/AppWrapper dict as a yaml file in the .codeflare folder
0 commit comments