From 428a2cbb257e4a7b8661a7691cf954fd70f11797 Mon Sep 17 00:00:00 2001 From: Steve Jahl <636687+sjahl@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:25:47 -0400 Subject: [PATCH] Updates ingress_production to use the static service names (#1632) --- .../subcommands/ingress_production.py | 45 +++---------------- deploy/manifests/ingress/gnomad.ingress.yaml | 18 +++++++- 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/deploy/deployctl/subcommands/ingress_production.py b/deploy/deployctl/subcommands/ingress_production.py index 6b9aa4923..3872eecf6 100644 --- a/deploy/deployctl/subcommands/ingress_production.py +++ b/deploy/deployctl/subcommands/ingress_production.py @@ -24,21 +24,6 @@ ports: - port: 80 targetPort: 80 ---- -apiVersion: v1 -kind: Service -metadata: - name: gnomad-reads - labels: - tier: production -spec: - type: NodePort - selector: - name: gnomad-reads - deployment: '{reads_deployment}' - ports: - - port: 80 - targetPort: 80 """ @@ -51,20 +36,13 @@ def get_current_browser_deployment() -> str: return browser_manifest["spec"]["selector"]["deployment"] -def get_current_reads_deployment() -> str: - reads_manifest = json.loads(kubectl(["get", "service", "gnomad-reads", "--output=json"])) - return reads_manifest["spec"]["selector"]["deployment"] - - def describe_services() -> None: browser_deployment = get_current_browser_deployment() - reads_deployment = get_current_reads_deployment() print("active browser deployment:", browser_deployment) - print("active reads deployment:", reads_deployment) -def apply_services(browser_deployment: str = None, reads_deployment: str = None) -> None: +def apply_services(browser_deployment: str = None) -> None: if browser_deployment: if not k8s_deployment_exists(f"gnomad-browser-{browser_deployment}"): raise RuntimeError(f"browser deployment {browser_deployment} not found") @@ -74,26 +52,15 @@ def apply_services(browser_deployment: str = None, reads_deployment: str = None) except Exception: # pylint: disable=broad-except; FIXME: Use a more specific exception class browser_deployment = get_most_recent_k8s_deployment("component=gnomad-browser")[len("gnomad-browser-") :] - if reads_deployment: - if not k8s_deployment_exists(f"gnomad-reads-{reads_deployment}"): - raise RuntimeError(f"reads deployment {reads_deployment} not found") - else: - try: - reads_deployment = get_current_reads_deployment() - except Exception: # pylint: disable=broad-except; FIXME: Use a more specific exception class - reads_deployment = get_most_recent_k8s_deployment("component=gnomad-reads")[len("gnomad-reads-") :] - - manifest = SERVICES_MANIFEST_TEMPLATE.format( - browser_deployment=browser_deployment, reads_deployment=reads_deployment - ) + manifest = SERVICES_MANIFEST_TEMPLATE.format(browser_deployment=browser_deployment) kubectl(["apply", "-f", "-"], input=manifest) - print(f"Updated production ingresses. browser: '{browser_deployment}', reads: '{reads_deployment}' ") + print(f"Updated production ingresses. browser: '{browser_deployment}' ") -def apply_ingress(browser_deployment: str = None, reads_deployment: str = None, quiet: bool = False) -> None: - apply_services(browser_deployment, reads_deployment) +def apply_ingress(browser_deployment: str = None, quiet: bool = False) -> None: + apply_services(browser_deployment) if quiet or input("Apply changes to production ingress (y/n) ").lower() == "y": kubectl(["apply", "-f", os.path.join(manifests_directory(), "gnomad.backendconfig.yaml")]) @@ -112,12 +79,10 @@ def main(argv: typing.List[str]) -> None: apply_services_parser = subparsers.add_parser("update") apply_services_parser.set_defaults(action=apply_services) apply_services_parser.add_argument("--browser-deployment") - apply_services_parser.add_argument("--reads-deployment") apply_ingress_parser = subparsers.add_parser("apply-ingress") apply_ingress_parser.set_defaults(action=apply_ingress) apply_ingress_parser.add_argument("--browser-deployment") - apply_ingress_parser.add_argument("--reads-deployment") apply_ingress_parser.add_argument("--quiet", action="store_true") args = parser.parse_args(argv) diff --git a/deploy/manifests/ingress/gnomad.ingress.yaml b/deploy/manifests/ingress/gnomad.ingress.yaml index db4eaac90..e08aa4e16 100644 --- a/deploy/manifests/ingress/gnomad.ingress.yaml +++ b/deploy/manifests/ingress/gnomad.ingress.yaml @@ -15,18 +15,32 @@ spec: paths: - backend: service: - name: gnomad-reads + name: reads-bluegreen-active-prod port: number: 80 path: /reads pathType: ImplementationSpecific - backend: service: - name: gnomad-reads + name: reads-bluegreen-active-prod port: number: 80 path: /reads/* pathType: ImplementationSpecific + - backend: + service: + name: reads-bluegreen-preview-prod + port: + number: 80 + path: /preview-reads + pathType: ImplementationSpecific + - backend: + service: + name: reads-bluegreen-preview-prod + port: + number: 80 + path: /preview-reads/* + pathType: ImplementationSpecific - backend: service: name: gnomad-blog