Closed ktaletsk closed 2 years ago
Could it be that you need to configure load_roles before services - because there is validation logic running just when you set c.JupyterHub.services
?
I just tried 2 things:
admin:services
from my admin-role
. Error went away.admin:services
and load roles before services. Error persists.I think the answer is admin:services
doesn't exist. See this list: https://jupyterhub.readthedocs.io/en/stable/rbac/scopes.html#available-scopes
What kind of change did you look to do? Use the JupyterHub REST API to add a JupyterHub registered service dynamically?
@consideRatio thanks for clarification. If the scope does not exist, we should update the documentation here: https://github.com/jupyterhub/jupyterhub/blob/2dc2c99b4a8965e5526e37e8bff35842e937a838/docs/source/reference/rest.md?plain=1#L110-L123
I was trying to get the equivalent behavior to to the old (v1.x) admin services. In particular, I have cull-idle services and generic admin service which is used to read users, groups and launch named servers. I guess, this is my hint to move on from the old ways and start using RBAC in earnest instead of blanket admin permissions.
For example, cull-idle is described in docs without giving admin access:
c.JupyterHub.services = [
{
"name": "idle-culler",
"command": [
sys.executable, "-m",
"jupyterhub_idle_culler",
"--timeout=3600"
],
}
]
c.JupyterHub.load_roles = [
{
"name": "idle-culler",
"description": "Culls idle servers",
"scopes": ["read:users:name", "read:users:activity", "servers"],
"services": ["idle-culler"],
}
]
Thanks for the help and we can probably close the issue
@ktaletsk for jupyterhub-idle-culler specifically, see https://github.com/jupyterhub/jupyterhub-idle-culler#permissions and note that if you are working with a distribution of jupyterhub like z2jh or tljh, that should be setup automatically for you - and if not - we should fix it. I know it is setup automatically in z2jh at this point, but not yet released - will be for z2jh 2.0.0+.
This issue can be resolved by updating this example to not reference an undefined scope like admin:services
.
@consideRatio thanks for clarification. If the scope does not exist, we should update the documentation here:
@consideRatio speaking of idle-culler, I also noticed the duplicated and inconsistent docs for cull-idle configs:
{
'name': 'cull-idle',
'command': ['python', '/path/to/cull-idle']
'admin': True,
}
Maybe unifying the docs for cull-idle and services in general could be useful?
@ktaletsk thanks for your work and summary of the situation! I opened https://github.com/jupyterhub/jupyterhub/issues/3814 to represent what you observed!
Bug description
I am trying to migrate to JupyterHub 2.1 from 2.0 and realized that my admin service does not work. I had the following configuration:
Following the instructions in the docs, I replaced the service and added the role:
After that, I am getting the error from JupyterHub:
And indeed, I cannot find mentions of
admin:service
nowhere else in the documentation or the code, other than in the chapter about admin services. The list of available scopes does haveadmin:users
, but not theadmin:services
.Is this
Your personal set up
jupyterhub 2.1.1