@@ -320,32 +320,40 @@ def deploy_namespaces(directory: Path):
320
320
)
321
321
return
322
322
323
+ processes = []
323
324
for namespace in namespaces_file ["namespaces" ]:
324
- click .echo (f"Deploying namespace: { namespace .get ('name' )} " )
325
- try :
326
- temp_override_file_path = ""
327
- namespace_name = namespace .get ("name" )
328
- namespace_config_override = {k : v for k , v in namespace .items () if k != "name" }
329
-
330
- cmd = f"{ HELM_COMMAND } { namespace_name } { NAMESPACES_CHART_LOCATION } -f { defaults_file_path } "
331
-
332
- if namespace_config_override :
333
- with tempfile .NamedTemporaryFile (
334
- mode = "w" , suffix = ".yaml" , delete = False
335
- ) as temp_file :
336
- yaml .dump (namespace_config_override , temp_file )
337
- temp_override_file_path = Path (temp_file .name )
338
- cmd = f"{ cmd } -f { temp_override_file_path } "
339
-
340
- if not stream_command (cmd ):
341
- click .echo (f"Failed to run Helm command: { cmd } " )
342
- return
343
- except Exception as e :
344
- click .echo (f"Error: { e } " )
325
+ p = Process (target = deploy_single_namespace , args = (namespace , defaults_file_path ))
326
+ p .start ()
327
+ processes .append (p )
328
+
329
+ for p in processes :
330
+ p .join ()
331
+
332
+
333
+ def deploy_single_namespace (namespace , defaults_file_path : Path ):
334
+ click .echo (f"Deploying namespace: { namespace .get ('name' )} " )
335
+ temp_override_file_path = ""
336
+ try :
337
+ namespace_name = namespace .get ("name" )
338
+ namespace_config_override = {k : v for k , v in namespace .items () if k != "name" }
339
+
340
+ cmd = f"{ HELM_COMMAND } { namespace_name } { NAMESPACES_CHART_LOCATION } -f { defaults_file_path } "
341
+
342
+ if namespace_config_override :
343
+ with tempfile .NamedTemporaryFile (mode = "w" , suffix = ".yaml" , delete = False ) as temp_file :
344
+ yaml .dump (namespace_config_override , temp_file )
345
+ temp_override_file_path = Path (temp_file .name )
346
+ cmd = f"{ cmd } -f { temp_override_file_path } "
347
+
348
+ if not stream_command (cmd ):
349
+ click .echo (f"Failed to run Helm command: { cmd } " )
345
350
return
346
- finally :
347
- if temp_override_file_path :
348
- temp_override_file_path .unlink ()
351
+ except Exception as e :
352
+ click .echo (f"Error: { e } " )
353
+ return
354
+ finally :
355
+ if temp_override_file_path :
356
+ Path (temp_override_file_path ).unlink ()
349
357
350
358
351
359
def is_windows ():
0 commit comments