support kubespawner running on a IPv6 only cluster

This commit is contained in:
Steffen Vogel
2020-04-15 23:21:53 +02:00
parent aa459aeb39
commit 6283e7ec83
5 changed files with 25 additions and 11 deletions

View File

@@ -566,7 +566,12 @@ class User:
else:
# >= 0.7 returns (ip, port)
proto = 'https' if self.settings['internal_ssl'] else 'http'
url = '%s://%s:%i' % ((proto,) + url)
# check if spawner returned an IPv6 address
if ':' in url[0]:
url = '%s://[%s]:%i' % ((proto,) + url)
else:
url = '%s://%s:%i' % ((proto,) + url)
urlinfo = urlparse(url)
server.proto = urlinfo.scheme
server.ip = urlinfo.hostname