Skip to content

Commit

Permalink
Remove old test code
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Davidson committed Nov 3, 2023
1 parent 1b4dc24 commit 72d498f
Showing 1 changed file with 2 additions and 67 deletions.
69 changes: 2 additions & 67 deletions binderhub-azimuth/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@ binderhub:
c.JupyterHub.authenticator_class = RemoteUserAuthenticator
# TODO: Make note of why install must happen in separate file
# 98-k8s-client-install.py: |
# import sys, subprocess
# subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'kubernetes'])
# subprocess.check_call([sys.executable, '-m', 'pip', 'list'])

99-zenith.py: |
import os
from kubernetes import client, config
Expand All @@ -268,50 +262,10 @@ binderhub:
jupyter_zenith_url = jupyter_zenith_reservation[0]['status']['fqdn']
binder_zenith_url = binder_zenith_reservation[0]['status']['fqdn']
print("Before:", c.JupyterHub.services)
# print("Before:", c.JupyterHub.services)
binder_service_idx = [i for i, s in enumerate(c.JupyterHub.services) if s['name'] == 'binder'][0]
c.JupyterHub.services[binder_service_idx]["oauth_redirect_uri"] = f'http://{binder_zenith_url}/oauth_callback'
print("After:", c.JupyterHub.services)
# import asyncio
# from kubernetes_asyncio import client, config
# async def set_zenith_url():
# config.load_incluster_config()
# # use the context manager to close http sessions automatically
# api = client.CustomObjectsApi()
# current_namespace = open("/var/run/secrets/kubernetes.io/serviceaccount/namespace").read()
# response = await api.list_namespaced_custom_object(
# 'zenith.stackhpc.com', 'v1alpha1', current_namespace, 'reservations'
# )
# reservations = response['items']
# jupyter_zenith_reservation = list(filter(
# lambda r: r['metadata']['name'].endswith('-binderhub-azimuth-jupyterhub'), reservations
# ))
# binder_zenith_reservation = list(filter(
# lambda r: r['metadata']['name'].endswith('-binderhub-azimuth'), reservations
# ))
# # if len(jupyter_zenith_reservation) != 1 or len(binder_zenith_reservation) != 1:
# # pass # TODO: Error logging?
# print("Services before:", c.JupyterHub.services)
# jupyter_zenith_url = jupyter_zenith_reservation[0]['status']['fqdn']
# binder_zenith_url = binder_zenith_reservation[0]['status']['fqdn']
# print("BinderHub Zenith FQDN:", binder_zenith_url)
# binder_service_idx = [i for i, s in enumerate(c.JupyterHub.services) if s['name'] == 'binder'][0]
# c.JupyterHub.services[binder_service_idx]["oauth_redirect_uri"] = f'http://{binder_zenith_url}/oauth_callback'
# print("Services after:", c.JupyterHub.services)
# # Run the function in the existing event loop
# asyncio.run(set_zenith_url())
# Testing
print("Services before:", c.JupyterHub.services)
binder_service_idx = [i for i, s in enumerate(c.JupyterHub.services) if s['name'] == 'binder'][0]
c.JupyterHub.services[binder_service_idx]["oauth_redirect_uri"] = f'http://test.com'
print("Services after:", c.JupyterHub.services)
# print("After:", c.JupyterHub.services)
singleuser:
cmd: jupyterhub-singleuser
Expand Down Expand Up @@ -404,22 +358,3 @@ binderhub:
print("Before:", os.environ)
os.environ['JUPYTERHUB_OAUTH_CALLBACK_URL'] = f'http://{binder_zenith_url}/oauth_callback'
print("After:", os.environ)
# print("Services:", c.JupyterHub.services.to_dict())
# print("Before:", c.JupyterHub.services.to_dict())
# binder_service_idx = [i for i, s in enumerate(c.JupyterHub.services) if s['name'] == 'binder'][0]
# c.JupyterHub.services[binder_service_idx]["oauth_redirect_uri"] = f'http://{binder_zenith_url}/oauth_callback'
# print("After:", c.JupyterHub.services.to_dict())
# c.HubOAuth.oauth_redirect_uri = f'http://{binder_zenith_url}/oauth_callback'
# print("Before:", c.JupyterHub.services)
# c.JupyterHub.services = [
# {
# "name": "binder",
# "oauth_redirect_uri": f'http://{binder_zenith_url}/oauth_callback',
# "oauth_client_id": "service-binderhub",
# "oauth_no_confirm": True,
# }
# ]
# print("After:", c.JupyterHub.services)

0 comments on commit 72d498f

Please sign in to comment.