Skip to content

Commit

Permalink
Merge pull request 2i2c-org#2416 from GeorgianaElena/debug-deployer
Browse files Browse the repository at this point in the history
deployer: add the option to pass the debug flag to helm when deploying hubs
  • Loading branch information
GeorgianaElena authored Mar 23, 2023
2 parents 2e08927 + c7d559c commit d7b9adf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions deployer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
Expand Down
14 changes: 12 additions & 2 deletions deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ 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.""",
),
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
Expand All @@ -163,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)
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)
hub.deploy(dask_gateway_version, debug, dry_run)


@app.command()
Expand Down
8 changes: 7 additions & 1 deletion deployer/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, dry_run):
"""
Deploy this hub
"""
Expand Down Expand Up @@ -204,6 +204,12 @@ def deploy(self, dask_gateway_version):
f"--values={generated_values_file.name}",
]

if dry_run:
cmd.append("--dry-run")

if debug:
cmd.append("--debug")

# Add on the values files
for values_file in values_files:
cmd.append(f"--values={values_file}")
Expand Down

0 comments on commit d7b9adf

Please sign in to comment.