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