-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restricting port range for spawned jupyterhub singleuser servers #102
Comments
Hi, This seems like a good idea overall. I'll leave some comments in the diff, but note that I'm not actually a batchspawner developer but have done a lot of work in it. (There isn't any current way to do this, unless OS can control the default bind ports and thus affect the behavior of My first thought was "this would be good to add to jupyterhub", but randomly checking two spawners show there isn't necessarily a lot of overlap. Plus it would require many jupyterhub releases before it could be relied on here anyway. Plus there's no default way for Have you seen #58? It is somewhat related in that it is about more clever port selection, but not limiting that selection. If we ever made progress on that, we should put these two together. I'll highlight @minrk since it possibly relates to jupyterhub itself. (btw, abstractly I still want to integrate #58 with JH but it's been slow going) |
I think the most general way to handle this would be for us to pull out the call to |
I think @mbmilligan's solution is quite clearly the right one for now... |
- Allows selection of random ports within a certain range only as a first use case. - Closes: jupyterhub#102 via a different strategy. - Currently uses the traitlet Any, but should be Callable - but this is not in upstream traitlets, it is special to kubespawner. So leave Any for now and change later.
In #114 I implemented @mbmilligan's suggestion. |
- Allows selection of random ports within a certain range only as a first use case. - Closes: jupyterhub#102 via a different strategy. - Currently uses the traitlet Any, but should be Callable - but this is not in upstream traitlets, it is special to kubespawner. So leave Any for now and change later.
Hello,
I needed to setup jupyterhub on a cluster which - due to data security requirements and policy - the incoming connections to the compute resources in the private IP space from the submission host have to be restricted to a limited number of predefined ports on which the compute nodes can be reached.
I did not seem to be able to control that feature within the existing code for the batchspawner.
I solved the problem with the following change in a fork of the repo
pontiggi@50428e8
in which I added an additional option, configurable in jupyterhub_config.py , to set the port range for the spawned singleuser servers. something like for example
c.BatchSpawnerBase.ports = '40000-41000'
I was wondering if there was any other way already existing in the orignal code base to achieve the same goal, with some option I might have missed.
Or, if there is not such option, if you are interested in incorporating this in the upstream code. In which case I'll be happy to cleanup the code as needed according to your guidelines and open a pull request.
Thanks for any advise or feedback
Best
Francesco
The text was updated successfully, but these errors were encountered: