def ssl_app(tmpdir_factory, kube_ns): """Partially instantiate a JupyterHub instance to generate ssl certificates Generates ssl certificates on the host, which will then be staged This is not a fully instantiated Hub, but it will have internal_ssl-related attributes such as .internal_trust_bundles and .internal_certs_location initialized. """ tmpdir = tmpdir_factory.mktemp("ssl") tmpdir.chdir() config = Config() config.JupyterHub.internal_ssl = True tmpdir.mkdir("internal-ssl") # use relative path for ssl certs config.JupyterHub.internal_certs_location = "internal-ssl" config.JupyterHub.trusted_alt_names = [ "DNS:hub-ssl", f"DNS:hub-ssl.{kube_ns}", f"DNS:hub-ssl.{kube_ns}.svc", f"DNS:hub-ssl.{kube_ns}.svc.cluster.local", ] app = JupyterHub(config=config) app.init_internal_ssl() return app
def ssl_app(tmpdir_factory): tmpdir = tmpdir_factory.mktemp("ssl") tmpdir.chdir() config = Config() config.JupyterHub.internal_ssl = True tmpdir.mkdir("internal-ssl") # use relative config.JupyterHub.internal_certs_location = "internal-ssl" app = JupyterHub(config=config) app.init_internal_ssl() return app