From 9cac94afe4066d9cd6b6aa4a80421adb800a3095 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Thu, 18 Feb 2021 16:59:42 +0200 Subject: [PATCH 1/8] Try unpinning deps and use a more up to date python consul client --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2e6e97bd..a000edc9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ jupyterhub>=0.9 etcd3 -aiohttp==3.6.2 -python-consul +aiohttp +python-consul2 passlib -toml==0.10.0 +toml escapism From 0aa4653a9f8aa0e95a37156a4fdb995f3d442a2d Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 12:36:19 +0200 Subject: [PATCH 2/8] Install newer consul version to be compatible with the new python client we're using --- jupyterhub_traefik_proxy/install.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jupyterhub_traefik_proxy/install.py b/jupyterhub_traefik_proxy/install.py index fdcbb999..7d80d5fb 100644 --- a/jupyterhub_traefik_proxy/install.py +++ b/jupyterhub_traefik_proxy/install.py @@ -26,6 +26,8 @@ } checksums_consul = { + "https://releases.hashicorp.com/consul/1.6.1/consul_1.6.1_linux_amd64.zip": "a8568ca7b6797030b2c32615b4786d4cc75ce7aee2ed9025996fe92b07b31f7e", + "https://releases.hashicorp.com/consul/1.6.1/consul_1.6.1_darwin_amd64.zip": "4bc205e06b2921f998cb6ddbe70de57f8e558e226e44aba3f337f2f245678b85", "https://releases.hashicorp.com/consul/1.5.0/consul_1.5.0_linux_amd64.zip": "1399064050019db05d3378f757e058ec4426a917dd2d240336b51532065880b6", "https://releases.hashicorp.com/consul/1.5.0/consul_1.5.0_darwin_amd64.zip": "b4033ea6871fe6136ee5d940c834be2248463c3ec248dc22370e6d5360931325", } @@ -355,7 +357,7 @@ def main(): parser.add_argument( "--consul-version", dest="consul_version", - default="1.5.0", + default="1.6.1", help=textwrap.dedent( """\ The version of consul to download. From 6900581d84e82a21407a7baec0bc2fe9fb6b4232 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 12:37:18 +0200 Subject: [PATCH 3/8] With python-consul2 client there's no need to hack into the session object to set the consul token --- jupyterhub_traefik_proxy/consul.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/jupyterhub_traefik_proxy/consul.py b/jupyterhub_traefik_proxy/consul.py index d55f5162..295821dd 100644 --- a/jupyterhub_traefik_proxy/consul.py +++ b/jupyterhub_traefik_proxy/consul.py @@ -64,10 +64,8 @@ def _default_client(self): token=self.kv_password, cert=self.consul_client_ca_cert, ) - client.http._session._default_headers.update( - {"X-Consul-Token": self.kv_password} - ) return client + return consul.aio.Consul( host=str(consul_service.hostname), port=consul_service.port, @@ -237,4 +235,3 @@ async def _kv_get_jupyterhub_prefixed_entries(self): async def stop(self): await super().stop() - await self.kv_client.http._session.close() From a0e75c9c7a1a6a15bc9262127beaaf0b18194fea Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 13:27:41 +0200 Subject: [PATCH 4/8] Update help text --- jupyterhub_traefik_proxy/install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyterhub_traefik_proxy/install.py b/jupyterhub_traefik_proxy/install.py index 7d80d5fb..3d0ea4bc 100644 --- a/jupyterhub_traefik_proxy/install.py +++ b/jupyterhub_traefik_proxy/install.py @@ -261,6 +261,8 @@ def main(): - consul: - v1.5.0_linux_amd64 - v1.5.0_darwin_amd64 + - v1.6.1_linux_amd64 + - v1.6.1_darwin_amd64 """ ), formatter_class=argparse.RawTextHelpFormatter, From 0bdbec0cf0fa7a3f2314e199b5aa6b8b53eaa7e8 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 13:27:56 +0200 Subject: [PATCH 5/8] Don't allow pre-releases --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b8ee895..de361516 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: - name: Install Python dependencies run: | pip install --upgrade setuptools pip - pip install --pre -r dev-requirements.txt --upgrade . + pip install -r dev-requirements.txt --upgrade . python -m jupyterhub_traefik_proxy.install --traefik --etcd --consul --output=./bin pip freeze - name: Run tests From efa520ead28812a0ce2ae5de0571881fef1e5c6d Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 13:56:06 +0200 Subject: [PATCH 6/8] Fix python>=3.8 warning --- jupyterhub_traefik_proxy/traefik_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jupyterhub_traefik_proxy/traefik_utils.py b/jupyterhub_traefik_proxy/traefik_utils.py index 5334ead1..76484f3e 100644 --- a/jupyterhub_traefik_proxy/traefik_utils.py +++ b/jupyterhub_traefik_proxy/traefik_utils.py @@ -46,12 +46,12 @@ def generate_backend_entry( proxy, backend_alias, separator="/", url=False, weight=False ): backend_entry = "" - if separator is "/": + if separator == "/": backend_entry = proxy.kv_traefik_prefix backend_entry += separator.join(["backends", backend_alias, "servers", "server1"]) - if url is True: + if url: backend_entry += separator + "url" - elif weight is True: + elif weight: backend_entry += separator + "weight" return backend_entry From 26dbe58594ad1eee30da14754ffbc069d10662e4 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 14:15:57 +0200 Subject: [PATCH 7/8] First generate config, then start the traefik process --- jupyterhub_traefik_proxy/proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub_traefik_proxy/proxy.py b/jupyterhub_traefik_proxy/proxy.py index c8ba2886..f350e070 100644 --- a/jupyterhub_traefik_proxy/proxy.py +++ b/jupyterhub_traefik_proxy/proxy.py @@ -270,8 +270,8 @@ async def start(self): **Subclasses must define this method** if the proxy is to be started by the Hub """ - self._start_traefik() await self._setup_traefik_static_config() + self._start_traefik() async def stop(self): """Stop the proxy. From a045b5bc67a3e05fb392f2a2441f2d901a8b8c3d Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 19 Feb 2021 14:36:49 +0200 Subject: [PATCH 8/8] Bump traefik default version --- jupyterhub_traefik_proxy/install.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jupyterhub_traefik_proxy/install.py b/jupyterhub_traefik_proxy/install.py index 3d0ea4bc..88231f6b 100644 --- a/jupyterhub_traefik_proxy/install.py +++ b/jupyterhub_traefik_proxy/install.py @@ -10,6 +10,8 @@ import warnings checksums_traefik = { + "https://github.com/containous/traefik/releases/download/v1.7.28/traefik_linux-amd64": "b70284ac72b4f9a119be92f206fc0c6dbc0db18ff7295d4df6701c0b292ecbf0", + "https://github.com/containous/traefik/releases/download/v1.7.28/traefik_darwin-amd64": "3e4bb0146bed06c842ae7a91e711e5ba98339f529b84aa80c766a01dd39d9731", "https://github.com/containous/traefik/releases/download/v1.7.18/traefik_linux-amd64": "3c2d153d80890b6fc8875af9f8ced32c4d684e1eb5a46d9815337cb343dfd92e", "https://github.com/containous/traefik/releases/download/v1.7.18/traefik_darwin-amd64": "84e07a184c31b7fb86417ba3a237ad334a26bcb1ed53fd56f0774afaa34074d9", "https://github.com/containous/traefik/releases/download/v1.7.5/traefik_linux-amd64": "4417a9d83753e1ad6bdd64bbbeaeb4b279bcc71542e779b7bcb3b027c6e3356e", @@ -247,6 +249,8 @@ def main(): """\ Checksums available for: - traefik: + - v1.7.28-linux-amd64 + - v1.7.28-darwin-amd64 - v1.7.18-linux-amd64 - v1.7.18-darwin-amd64 - v1.7.5-linux-amd64 @@ -311,7 +315,7 @@ def main(): parser.add_argument( "--traefik-version", dest="traefik_version", - default="1.7.18", + default="1.7.28", help=textwrap.dedent( """\ The version of traefik to download.