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

Try unpinning deps and use a more up to date python consul client #115

Merged
merged 8 commits into from
Feb 19, 2021
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions jupyterhub_traefik_proxy/consul.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
12 changes: 10 additions & 2 deletions jupyterhub_traefik_proxy/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -26,6 +28,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",
}
Expand Down Expand Up @@ -245,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
Expand All @@ -259,6 +265,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,
Expand Down Expand Up @@ -307,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.
Expand Down Expand Up @@ -355,7 +363,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.
Expand Down
2 changes: 1 addition & 1 deletion jupyterhub_traefik_proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions jupyterhub_traefik_proxy/traefik_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jupyterhub>=0.9
etcd3
aiohttp==3.6.2
python-consul
aiohttp
python-consul2
passlib
toml==0.10.0
toml
escapism