From 85b481ea195fb2b5c54c40e5562c874c42c0f8d6 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 15 Nov 2022 23:41:43 -0800 Subject: [PATCH] Remove binderhub registry generated config from deployer Ref https://github.com/2i2c-org/infrastructure/issues/1925 --- .../clusters/2i2c/binder-staging.values.yaml | 7 ++++++ deployer/hub.py | 24 ------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/config/clusters/2i2c/binder-staging.values.yaml b/config/clusters/2i2c/binder-staging.values.yaml index ed2d089651..8123f33063 100644 --- a/config/clusters/2i2c/binder-staging.values.yaml +++ b/config/clusters/2i2c/binder-staging.values.yaml @@ -1,6 +1,13 @@ binderhub: + registry: + url: https://us-central1-docker.pkg.dev config: + DockerRegistry: + token_url: https://us-central1-docker.pkg.dev/v2/token?service= BinderHub: + hub_url: https://hub.binder-staging.2i2c.cloud + image_prefix: us-central1-docker.pkg.dev/two-eye-two-see/binder-staging-registry/binder-staging- + template_path: /etc/binderhub/custom/templates extra_static_path: /etc/binderhub/custom/static extra_static_url_prefix: /extra_static/ diff --git a/deployer/hub.py b/deployer/hub.py index 9e21334125..ae0cea3673 100644 --- a/deployer/hub.py +++ b/deployer/hub.py @@ -31,32 +31,8 @@ def get_generated_config(self, auth_provider: KeyProvider): WARNING: MIGHT CONTAINS SECRET VALUES! """ if self.spec["helm_chart"] == "binderhub": - # For Google Artifact registry, this takes the following form: - # {LOCATION}-docker.pkg.dev - # If the zone of the cluster is us-central1-b, then the location is us-central1 - registry_url = f"{'-'.join(self.cluster.spec['gcp']['zone'].split('-')[:2])}-docker.pkg.dev" - - # NOTE: We are hard-coding config for using Google Artifact Registry here. - # We should not. Instead we should provide a way to support as many container - # registries as BinderHub supports. We are hard-coding this config here - # because we need to generate parts of it from the cluster object spec, - # so to generalise, we may have to live with some copy-pasting of certain - # values such as cluster project and location. generated_config = { "binderhub": { - "registry": {"url": f"https://{registry_url}"}, - "config": { - "BinderHub": { - "hub_url": f"https://hub.{self.spec['domain']}", - # For Google Artifact registry, this takes the following form: - # {registry_url}/{PROJECT_ID}/{REPOSITORY}-registry/{IMAGE}- - # REPOSITORY and IMAGE will both be the hub namespace - "image_prefix": f"{registry_url}/{self.cluster.spec['gcp']['project']}/{self.spec['name']}-registry/{self.spec['name']}-", - }, - "DockerRegistry": { - "token_url": f"https://{registry_url}/v2/token?service=" - }, - }, "ingress": { "hosts": [self.spec["domain"]], "tls": [