@@ -309,7 +309,11 @@ def get_default_kueue_name(namespace: str):
309
309
310
310
311
311
def write_components (
312
- user_yaml : dict , output_file_name : str , namespace : str , local_queue : Optional [str ]
312
+ user_yaml : dict ,
313
+ output_file_name : str ,
314
+ namespace : str ,
315
+ local_queue : Optional [str ],
316
+ user_labels : dict ,
313
317
):
314
318
# Create the directory if it doesn't exist
315
319
directory_path = os .path .dirname (output_file_name )
@@ -331,6 +335,7 @@ def write_components(
331
335
]
332
336
labels = component ["generictemplate" ]["metadata" ]["labels" ]
333
337
labels .update ({"kueue.x-k8s.io/queue-name" : lq_name })
338
+ labels .update (user_labels )
334
339
outfile .write ("---\n " )
335
340
yaml .dump (
336
341
component ["generictemplate" ], outfile , default_flow_style = False
@@ -339,7 +344,11 @@ def write_components(
339
344
340
345
341
346
def load_components (
342
- user_yaml : dict , name : str , namespace : str , local_queue : Optional [str ]
347
+ user_yaml : dict ,
348
+ name : str ,
349
+ namespace : str ,
350
+ local_queue : Optional [str ],
351
+ user_labels : dict ,
343
352
):
344
353
component_list = []
345
354
components = user_yaml .get ("spec" , "resources" )["resources" ].get ("GenericItems" )
@@ -355,6 +364,7 @@ def load_components(
355
364
]
356
365
labels = component ["generictemplate" ]["metadata" ]["labels" ]
357
366
labels .update ({"kueue.x-k8s.io/queue-name" : lq_name })
367
+ labels .update (user_labels )
358
368
component_list .append (component ["generictemplate" ])
359
369
360
370
resources = "---\n " + "---\n " .join (
@@ -395,6 +405,7 @@ def generate_appwrapper(
395
405
write_to_file : bool ,
396
406
verify_tls : bool ,
397
407
local_queue : Optional [str ],
408
+ user_labels ,
398
409
):
399
410
user_yaml = read_template (template )
400
411
appwrapper_name , cluster_name = gen_names (name )
@@ -446,11 +457,13 @@ def generate_appwrapper(
446
457
if mcad :
447
458
write_user_appwrapper (user_yaml , outfile )
448
459
else :
449
- write_components (user_yaml , outfile , namespace , local_queue )
460
+ write_components (user_yaml , outfile , namespace , local_queue , user_labels )
450
461
return outfile
451
462
else :
452
463
if mcad :
453
464
user_yaml = load_appwrapper (user_yaml , name )
454
465
else :
455
- user_yaml = load_components (user_yaml , name , namespace , local_queue )
466
+ user_yaml = load_components (
467
+ user_yaml , name , namespace , local_queue , user_labels
468
+ )
456
469
return user_yaml
0 commit comments