@@ -99,6 +99,20 @@ def update_image_pull_secrets(spec, image_pull_secrets):
99
99
]
100
100
101
101
102
+ def update_volume_mounts (spec , volume_mounts : list ):
103
+ containers = spec .get ("containers" )
104
+ for volume_mount in volume_mounts :
105
+ for container in containers :
106
+ volumeMount = client .ApiClient ().sanitize_for_serialization (volume_mount )
107
+ container ["volumeMounts" ].append (volumeMount )
108
+
109
+
110
+ def update_volumes (spec , volumes : list ):
111
+ for volume in volumes :
112
+ new_volume = client .ApiClient ().sanitize_for_serialization (volume )
113
+ spec ["volumes" ].append (new_volume )
114
+
115
+
102
116
def update_env (spec , env ):
103
117
containers = spec .get ("containers" )
104
118
for container in containers :
@@ -139,6 +153,8 @@ def update_nodes(
139
153
head_cpus ,
140
154
head_memory ,
141
155
head_gpus ,
156
+ volumes ,
157
+ volume_mounts ,
142
158
):
143
159
if "template" in item .keys ():
144
160
head = item .get ("template" ).get ("spec" ).get ("headGroupSpec" )
@@ -154,6 +170,8 @@ def update_nodes(
154
170
155
171
for comp in [head , worker ]:
156
172
spec = comp .get ("template" ).get ("spec" )
173
+ update_volume_mounts (spec , volume_mounts )
174
+ update_volumes (spec , volumes )
157
175
update_image_pull_secrets (spec , image_pull_secrets )
158
176
update_image (spec , image )
159
177
update_env (spec , env )
@@ -322,6 +340,8 @@ def generate_appwrapper(
322
340
verify_tls : bool ,
323
341
local_queue : Optional [str ],
324
342
labels ,
343
+ volumes : list [client .V1Volume ],
344
+ volume_mounts : list [client .V1VolumeMount ],
325
345
):
326
346
user_yaml = read_template (template )
327
347
appwrapper_name , cluster_name = gen_names (name )
@@ -349,6 +369,8 @@ def generate_appwrapper(
349
369
head_cpus ,
350
370
head_memory ,
351
371
head_gpus ,
372
+ volumes ,
373
+ volume_mounts ,
352
374
)
353
375
354
376
augment_labels (item , labels )
0 commit comments