From 86214917ad1cde9dd7ad32b3153fd78acc1af293 Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Thu, 23 Mar 2023 15:43:51 +0200 Subject: [PATCH 1/3] Add the debug option to pass to helm when deploying hub --- deployer/deployer.py | 9 +++++++-- deployer/hub.py | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/deployer/deployer.py b/deployer/deployer.py index fa74095312..5a333e9436 100644 --- a/deployer/deployer.py +++ b/deployer/deployer.py @@ -146,6 +146,11 @@ def deploy( dask_gateway_version: str = typer.Option( "2023.1.0", help="Version of dask-gateway to install CRDs for" ), + debug: bool = typer.Option( + False, + "--debug", + help="""When present, the `--debug` flag will be passed to the `helm upgrade` command.""", + ), ): """ Deploy one or more hubs in a given cluster @@ -163,13 +168,13 @@ def deploy( if hub_name: hub = next((hub for hub in hubs if hub.spec["name"] == hub_name), None) print_colour(f"Deploying hub {hub.spec['name']}...") - hub.deploy(dask_gateway_version) + hub.deploy(dask_gateway_version, debug) else: for i, hub in enumerate(hubs): print_colour( f"{i+1} / {len(hubs)}: Deploying hub {hub.spec['name']}..." ) - hub.deploy(dask_gateway_version) + hub.deploy(dask_gateway_version, debug) @app.command() diff --git a/deployer/hub.py b/deployer/hub.py index 17b8eb8e6b..60325be7f4 100644 --- a/deployer/hub.py +++ b/deployer/hub.py @@ -142,7 +142,7 @@ def get_generated_config(self): return generated_config - def deploy(self, dask_gateway_version): + def deploy(self, dask_gateway_version, debug): """ Deploy this hub """ @@ -204,6 +204,9 @@ def deploy(self, dask_gateway_version): f"--values={generated_values_file.name}", ] + if debug: + cmd.append("--debug") + # Add on the values files for values_file in values_files: cmd.append(f"--values={values_file}") From 4c0f8ada8254d649e8964c459b918b6af949a630 Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Thu, 23 Mar 2023 16:13:50 +0200 Subject: [PATCH 2/3] Add the dry-run option too --- deployer/deployer.py | 9 +++++++-- deployer/hub.py | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/deployer/deployer.py b/deployer/deployer.py index 5a333e9436..9a0fff6d85 100644 --- a/deployer/deployer.py +++ b/deployer/deployer.py @@ -151,6 +151,11 @@ def deploy( "--debug", help="""When present, the `--debug` flag will be passed to the `helm upgrade` command.""", ), + dry_run: bool = typer.Option( + False, + "--dry-run", + help="""When present, the `--dry-run` flag will be passed to the `helm upgrade` command.""", + ), ): """ Deploy one or more hubs in a given cluster @@ -168,13 +173,13 @@ def deploy( if hub_name: hub = next((hub for hub in hubs if hub.spec["name"] == hub_name), None) print_colour(f"Deploying hub {hub.spec['name']}...") - hub.deploy(dask_gateway_version, debug) + hub.deploy(dask_gateway_version, debug, dry_run) else: for i, hub in enumerate(hubs): print_colour( f"{i+1} / {len(hubs)}: Deploying hub {hub.spec['name']}..." ) - hub.deploy(dask_gateway_version, debug) + hub.deploy(dask_gateway_version, debug, dry_run) @app.command() diff --git a/deployer/hub.py b/deployer/hub.py index 60325be7f4..6034c7db34 100644 --- a/deployer/hub.py +++ b/deployer/hub.py @@ -142,7 +142,7 @@ def get_generated_config(self): return generated_config - def deploy(self, dask_gateway_version, debug): + def deploy(self, dask_gateway_version, debug, dry_run): """ Deploy this hub """ @@ -204,6 +204,9 @@ def deploy(self, dask_gateway_version, debug): f"--values={generated_values_file.name}", ] + if dry_run: + cmd.append("--dry-run") + if debug: cmd.append("--debug") From c7d559c82545b7c3a86a4309b8b4208fa69ef720 Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Thu, 23 Mar 2023 16:14:05 +0200 Subject: [PATCH 3/3] Update deployer readme --- deployer/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployer/README.md b/deployer/README.md index 3bad308c1a..a2483be5e8 100644 --- a/deployer/README.md +++ b/deployer/README.md @@ -91,9 +91,9 @@ It takes a name of a cluster and a name of a hub (or list of names) as arguments │ [default: None] │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ -│ --config-path TEXT File to read secret deployment config from │ -│ [default: shared/deployer/enc-auth-providers-credentials.secret.yaml] │ -│ --dask-gateway-version TEXT Version of dask-gateway to install CRDs for [default: v2022.10.0] │ +│ --dask-gateway-version TEXT Version of dask-gateway to install CRDs for [default: 2023.1.0] │ +│ --debug When present, the `--debug` flag will be passed to the `helm upgrade` command. │ +│ --dry-run When present, the `--dry-run` flag will be passed to the `helm upgrade` command. │ │ --help Show this message and exit. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ```