Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a command line flag for specifying the number of API replicas #1596

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion deploy/deployctl/subcommands/browser_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
commonLabels:
deployment: '{deployment_name}'
nameSuffix: '-{deployment_name}'
replicas:
- name: gnomad-api
count: {api_replicas_count}
images:
- name: gnomad-api
newName: {api_image_repository}
Expand Down Expand Up @@ -81,7 +84,7 @@ def list_deployments() -> None:
print(deployment[len("gnomad-browser-") :])


def create_deployment(name: str, browser_tag: str = None, api_tag: str = None) -> None:
def create_deployment(name: str, api_replicas_count: int = None, browser_tag: str = None, api_tag: str = None) -> None:
if not name:
name = datetime.datetime.now().strftime("%Y%m%d-%H%M")
else:
Expand All @@ -92,6 +95,9 @@ def create_deployment(name: str, browser_tag: str = None, api_tag: str = None) -
if name == "latest":
raise ValueError("'latest' cannot be used for a deployment name")

if not api_replicas_count:
api_replicas_count = 4

deployment_directory = os.path.join(deployments_directory(), name)

if os.path.exists(deployment_directory):
Expand Down Expand Up @@ -119,6 +125,7 @@ def create_deployment(name: str, browser_tag: str = None, api_tag: str = None) -
browser_image_repository=config.browser_image_repository,
browser_tag=browser_tag,
api_image_repository=config.api_image_repository,
api_replicas_count=api_replicas_count,
api_tag=api_tag,
project=config.project,
cluster_name=config.gke_cluster_name,
Expand Down Expand Up @@ -174,6 +181,7 @@ def main(argv: typing.List[str]) -> None:
create_parser.add_argument("--name")
create_parser.add_argument("--browser-tag")
create_parser.add_argument("--api-tag")
create_parser.add_argument("--api-replicas-count", type=int)

apply_parser = subparsers.add_parser("apply")
apply_parser.set_defaults(action=apply_deployment)
Expand Down
Loading