|
1 | 1 | import subprocess
|
2 | 2 | import sys
|
3 | 3 | import tempfile
|
| 4 | +from multiprocessing import Process |
4 | 5 | from pathlib import Path
|
5 | 6 | from typing import Optional
|
6 | 7 |
|
@@ -69,17 +70,44 @@ def _deploy(directory, debug, namespace, to_all_users):
|
69 | 70 |
|
70 | 71 | if to_all_users:
|
71 | 72 | namespaces = get_namespaces_by_type(WARGAMES_NAMESPACE_PREFIX)
|
| 73 | + processes = [] |
72 | 74 | for namespace in namespaces:
|
73 |
| - deploy(directory, debug, namespace.metadata.name, False) |
| 75 | + p = Process(target=deploy, args=(directory, debug, namespace.metadata.name, False)) |
| 76 | + p.start() |
| 77 | + processes.append(p) |
| 78 | + for p in processes: |
| 79 | + p.join() |
74 | 80 | return
|
75 | 81 |
|
76 | 82 | if (directory / NETWORK_FILE).exists():
|
77 |
| - dl = deploy_logging_stack(directory, debug) |
78 |
| - deploy_network(directory, debug, namespace=namespace) |
79 |
| - df = deploy_fork_observer(directory, debug) |
80 |
| - if dl | df: |
81 |
| - deploy_ingress(debug) |
82 |
| - deploy_caddy(directory, debug) |
| 83 | + processes = [] |
| 84 | + logging_process = Process(target=deploy_logging_stack, args=(directory, debug)) |
| 85 | + logging_process.start() |
| 86 | + processes.append(logging_process) |
| 87 | + |
| 88 | + network_process = Process(target=deploy_network, args=(directory, debug, namespace)) |
| 89 | + network_process.start() |
| 90 | + |
| 91 | + ingress_process = Process(target=deploy_ingress, args=(debug,)) |
| 92 | + ingress_process.start() |
| 93 | + processes.append(ingress_process) |
| 94 | + |
| 95 | + caddy_process = Process(target=deploy_caddy, args=(directory, debug)) |
| 96 | + caddy_process.start() |
| 97 | + processes.append(caddy_process) |
| 98 | + |
| 99 | + # Wait for the network process to complete |
| 100 | + network_process.join() |
| 101 | + |
| 102 | + # Start the fork observer process immediately after network process completes |
| 103 | + fork_observer_process = Process(target=deploy_fork_observer, args=(directory, debug)) |
| 104 | + fork_observer_process.start() |
| 105 | + processes.append(fork_observer_process) |
| 106 | + |
| 107 | + # Wait for all other processes to complete |
| 108 | + for p in processes: |
| 109 | + p.join() |
| 110 | + |
83 | 111 | elif (directory / NAMESPACES_FILE).exists():
|
84 | 112 | deploy_namespaces(directory)
|
85 | 113 | else:
|
|
0 commit comments