Skip to content

Commit 09b7230

Browse files
committed
deploy logging CRDs first
1 parent 5c18af9 commit 09b7230

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/warnet/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@
9696
},
9797
}
9898

99+
LOGGING_CRD_COMMANDS = [
100+
"helm repo add prometheus-community https://prometheus-community.github.io/helm-charts",
101+
"helm repo update",
102+
"helm upgrade --install prometheus-operator-crds prometheus-community/prometheus-operator-crds",
103+
]
104+
99105
# Helm commands for logging setup
100106
# TODO: also lots of hardcode stuff in these helm commands, will need to fix this when moving to helm charts
101107
LOGGING_HELM_COMMANDS = [

src/warnet/deploy.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
FORK_OBSERVER_CHART,
1717
HELM_COMMAND,
1818
INGRESS_HELM_COMMANDS,
19+
LOGGING_CRD_COMMANDS,
1920
LOGGING_HELM_COMMANDS,
2021
LOGGING_NAMESPACE,
2122
NAMESPACES_CHART_LOCATION,
@@ -87,6 +88,9 @@ def _deploy(directory, debug, namespace, to_all_users):
8788

8889
if (directory / NETWORK_FILE).exists():
8990
processes = []
91+
# Deploy logging CRD first to avoid synchronisation issues
92+
deploy_logging_crd(directory, debug)
93+
9094
logging_process = Process(target=deploy_logging_stack, args=(directory, debug))
9195
logging_process.start()
9296
processes.append(logging_process)
@@ -146,11 +150,30 @@ def check_logging_required(directory: Path):
146150
return False
147151

148152

153+
def deploy_logging_crd(directory: Path, debug: bool) -> bool:
154+
"""
155+
This function exists so we can parallelise the rest of the loggin stack
156+
installation
157+
"""
158+
if not check_logging_required(directory):
159+
return False
160+
161+
click.echo(
162+
"Found collectLogs or metricsExport in network definition, Deploying logging stack CRD"
163+
)
164+
165+
for command in LOGGING_CRD_COMMANDS:
166+
if not stream_command(command):
167+
print(f"Failed to run Helm command: {command}")
168+
return False
169+
return True
170+
171+
149172
def deploy_logging_stack(directory: Path, debug: bool) -> bool:
150173
if not check_logging_required(directory):
151174
return False
152175

153-
click.echo("Found collectLogs or metricsExport in network definition, Deploying logging stack")
176+
click.echo("Deploying logging stack")
154177

155178
for command in LOGGING_HELM_COMMANDS:
156179
if not stream_command(command):

0 commit comments

Comments
 (0)