Skip to content

Commit 2f7b79a

Browse files
authored
[2i2c-jetstream2] Add jupyterhub-groups-exporter config (#6077)
* Add jupyterhub-groups-exporter config * Use auth_state_groups_key instead of custom authenticator
1 parent b8ea88a commit 2f7b79a

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

config/clusters/2i2c-jetstream2/staging.values.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,42 @@ jupyterhub:
6666
capi.stackhpc.com/node-group: core
6767
config:
6868
JupyterHub:
69-
authenticator_class: "github"
69+
authenticator_class: github
7070
GitHubOAuthenticator:
7171
oauth_callback_url: "https://staging.js.2i2c.cloud/hub/oauth_callback"
72+
populate_teams_in_auth_state: true
73+
allowed_organizations:
74+
- 2i2c-org:hub-access-for-2i2c-staff
75+
scope:
76+
- read:org
77+
Authenticator:
78+
enable_auth_state: true
79+
manage_groups: true
80+
services:
81+
jupyterhub-groups-exporter: {}
82+
loadRoles:
83+
jupyterhub-groups-exporter:
84+
services:
85+
- jupyterhub-groups-exporter
86+
scopes:
87+
- users
88+
- groups
89+
extraConfig:
90+
custom-auth-state-groups-key: |
91+
async def custom_auth_state_groups_key(auth_state):
92+
groups_list = []
93+
if auth_state is None:
94+
print("Auth state is None")
95+
return groups_list
96+
else:
97+
for team in auth_state["teams"]:
98+
if f'{team["organization"]["login"]}:{team["slug"]}' not in c.GitHubOAuthenticator.allowed_organizations:
99+
continue
100+
else:
101+
groups_list.append(f'{team["organization"]["login"]}:{team["slug"]}')
102+
return groups_list
103+
if c.GitHubOAuthenticator:
104+
c.GitHubOAuthenticator.auth_state_groups_key = custom_auth_state_groups_key
72105
singleuser:
73106
defaultUrl: /lab
74107
nodeSelector:
@@ -147,3 +180,9 @@ jupyterhub-home-nfs:
147180
volumeId: 694b2c04-6b08-4ebe-8cb9-74f7d42c1b1c
148181
quotaEnforcer:
149182
hardQuota: 1 # in GB
183+
path: "/export/staging"
184+
jupyterhub-groups-exporter:
185+
enabled: true
186+
config:
187+
groupsExporter:
188+
update_exporter_interval: 3600

0 commit comments

Comments
 (0)