Skip to content

Commit

Permalink
Try with dummy url
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Davidson committed Nov 3, 2023
1 parent 503ab53 commit a36ec10
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions binderhub-azimuth/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,36 +240,38 @@ binderhub:
# binderhub and jupyterhub work correctly for OAuth flows.
# Ensure kubernetes package is available by invoking pip as a subprocess
import sys, subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'kubernetes'])
# import sys, subprocess, time
# subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'kubernetes'])
# time.sleep(1)
from kubernetes import client, config
# from kubernetes import client, config
config.load_incluster_config()
api = client.CustomObjectsApi()
current_namespace = open("/var/run/secrets/kubernetes.io/serviceaccount/namespace").read()
# config.load_incluster_config()
# api = client.CustomObjectsApi()
# current_namespace = open("/var/run/secrets/kubernetes.io/serviceaccount/namespace").read()
reservations = api.list_namespaced_custom_object(
'zenith.stackhpc.com', 'v1alpha1', current_namespace, 'reservations'
)['items']
# reservations = api.list_namespaced_custom_object(
# 'zenith.stackhpc.com', 'v1alpha1', current_namespace, 'reservations'
# )['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?
# 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?
jupyter_zenith_url = jupyter_zenith_reservation[0]['status']['fqdn']
binder_zenith_url = binder_zenith_reservation[0]['status']['fqdn']
# jupyter_zenith_url = jupyter_zenith_reservation[0]['status']['fqdn']
# binder_zenith_url = binder_zenith_reservation[0]['status']['fqdn']
print("Before:", c.JupyterHub.services)
c.JupyterHub.services = [
{
"name": "binder",
"oauth_redirect_uri": f'http://{binder_zenith_url}/oauth_callback',
# "oauth_redirect_uri": f'http://{binder_zenith_url}/oauth_callback',
"oauth_redirect_uri": f'https://google.com',
"oauth_client_id": "service-binderhub",
"oauth_no_confirm": True,
}
Expand Down

0 comments on commit a36ec10

Please sign in to comment.