From 32fd66019d405afc82042cc09a1e4263251ac2a5 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Mon, 28 Aug 2023 18:46:57 -0700 Subject: [PATCH 1/3] Try bugfix for unlisted_choice API Brings in https://github.com/jupyterhub/kubespawner/pull/769 --- helm-charts/images/hub/unlisted-choice-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-charts/images/hub/unlisted-choice-requirements.txt b/helm-charts/images/hub/unlisted-choice-requirements.txt index 2186d5ee7..27ee25150 100644 --- a/helm-charts/images/hub/unlisted-choice-requirements.txt +++ b/helm-charts/images/hub/unlisted-choice-requirements.txt @@ -1,3 +1,3 @@ git+https://github.com/yuvipanda/jupyterhub-configurator@ed7e3a0df1e3d625d10903ef7d7fd9c2fbb548db # Brings on using `unlisted_choice` in profile options per https://github.com/2i2c-org/infrastructure/issues/2146 -git+https://github.com/jupyterhub/kubespawner@def501f1d60b8e5629745acb0bcc45b151b1decc +git+https://github.com/jupyterhub/kubespawner@934ef321f72e58bd680d35ea5fd6780b2b8b52c7 From 8d0d3d1f0dce4037a467f49d77dbeee36df14e15 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Mon, 28 Aug 2023 23:05:07 -0700 Subject: [PATCH 2/3] Deploy unlisted_choice on LEAP hub --- config/clusters/leap/common.values.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/clusters/leap/common.values.yaml b/config/clusters/leap/common.values.yaml index 12a285697..12cf4b8dd 100644 --- a/config/clusters/leap/common.values.yaml +++ b/config/clusters/leap/common.values.yaml @@ -37,6 +37,9 @@ basehub: name: LEAP url: https://leap-stc.github.io hub: + image: + name: quay.io/2i2c/unlisted-choice-experiment + tag: "0.0.1-0.dev.git.6801.h3f4f0c4a" allowNamedServers: true config: Authenticator: @@ -189,6 +192,13 @@ basehub: cpu_limit: 16 image: &profile_list_profile_options_image display_name: Image + unlisted_choice: &profile_list_unlisted_choice + enabled: True + display_name: "Custom image" + validation_regex: "^.+:.+$" + validation_message: "Must be a valid public docker image, including a tag" + kubespawner_override: + image: "{value}" choices: pangeo_new: display_name: Base Pangeo Notebook ("2023.07.05") @@ -268,6 +278,7 @@ basehub: profile_options: image: display_name: Image + unlisted_choice: *profile_list_unlisted_choice choices: tensorflow_new: display_name: Pangeo Tensorflow ML Notebook ("2023.07.05") From b62a46a019f3b6b76dc5807e07f51883f0a1368c Mon Sep 17 00:00:00 2001 From: Georgiana Dolocan Date: Tue, 29 Aug 2023 17:27:12 +0300 Subject: [PATCH 3/3] Make a copy of the original profile_list to not modify it by mistake --- helm-charts/basehub/values.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helm-charts/basehub/values.yaml b/helm-charts/basehub/values.yaml index 5a588e51c..b19bd7d55 100644 --- a/helm-charts/basehub/values.yaml +++ b/helm-charts/basehub/values.yaml @@ -697,6 +697,8 @@ jupyterhub: ) c.Spawner.pre_spawn_hook = ensure_db_pvc 05-gh-teams: | + import copy + from textwrap import dedent from tornado import gen, web from oauthenticator.github import GitHubOAuthenticator @@ -745,8 +747,10 @@ jupyterhub: print(f"User {spawner.user.name} is part of teams {' '.join(teams)}") allowed_profiles = [] - - for profile in original_profile_list: + # Make a copy of the original profile_list dict, + # otherwise we might end up modifying it by mistake + profile_list_copy = copy.deepcopy(original_profile_list) + for profile in profile_list_copy: # If there is no ':' in allowed_teams, it's an org and we should check that # differently allowed_orgs = set([o for o in profile.get('allowed_teams', []) if ':' not in o])