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