-
Notifications
You must be signed in to change notification settings - Fork 303
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
Shouldn't KubeSpawner's cmd/args map to the K8s container's command/args? #493
Comments
I am trying to launch a rstudio image with this, and I am very much struggling that I can not "completely control" the |
Do you think we can resolve this issue before Z2JH 1.0.0 is released? Either by adding docs and warnings, or perhaps by adding a new Although this is a K8s project I think it's fine to use the Docker terminology, especially as it's also the Open Container Initiative terminology. What's more important is that we make it clear and use consistent names throughout. |
I agree that we must be consistent, and in this case we must be consistent against the We would then document that To conclude: 👍 for adding |
@consideRatio is there going to be a separate fix for |
@mapsacosta if you set |
UpdateIn the initial post I wrote investigative conclusions, and I want to give an update about those two points.
About
|
Configuration | Resulting argument |
---|---|
spawner.ip |
--ip=... |
spawner.port |
--port=... |
spawner.default_url |
--SingleUserNotebookApp.default_url=... |
spawner.notebook_dir |
--notebook-dir=... |
spawner.debug |
--debug |
spawner.disable_user_config |
--disable-user-config |
spawner.args |
<user defined args> |
Action points
- Add
entrypoint
configuration (@consideRatio works on this) - Update docs etc to bring more clarity to
cmd
,entrypoint
, andargs
(@consideRatio works on this) - Clarify how to resolve point 2 (@manics @minrk could you help deliberate about this?)
- Resolve point 2
Related
- Rewrite help for Kubespawner.cmd #502 - updated
cmd
config documentation
A non-breaking way to achieve (2) could be to treat the empty string as a special value, so On the other hand if we go for a breaking change I think either we should keep the ability to not pass additional arguments, or clearly document the command arguments interface that should be supported. Originally jupyter-notebook was the only client, but now we have jupyter-lab, jupyter-server, and people have written their own alternatives such as https://discourse.jupyter.org/t/new-package-to-run-arbitrary-web-service-in-jupyterhub-jhsingle-native-proxy/3493 (which is also one of the motivations for jupyterhub/zero-to-jupyterhub-k8s#2138) |
Hmmm... I think we should opt for a potentially breaking change to resolve the future needs properly.
I realize now that we can't augment So... setting Also... you may want to configure I think what we must support is opt-in/out-out of
I wonder if perhaps the Spawner base class should add some configuration about this though rather than KubeSpawner, and then we make use and adjust around that? The current behavior in KubeSpawner is KubeSpawner specific, and I think the Spawner base class current behavior is to always append |
It is extremely confusing that Kubernetes renames Docker's Entrypoint and Command as Command and Args, respectively! While Kubernetes' names more accurately describe what happens (a command is passed arguments), I think the docker names more accurately describe what they are for (an entrypoint prepares an environment in which to launch a command). In that sense, cmd and args are used to build a single command list, which we pass to kubernetes container arguments, just like we would with This is part of why I think things like docker stacks should implement their environment customization in entrypoint instead of CMD. Overriding CMD shouldn't be hugely consequential, but it is for docker-stacks.
I'd add that option 2 would also require restoring the default
I think this is really a KubeSpawner-specific issue, and should probably be a kubespawner option. It is really only the "get the default command from the image with kubespawner" case that is affected, because kubespawner cannot actually retrieve this info from the image. If the command is specified, everything works. The Spawner API is that This is related to why I opened jupyterhub/jupyterhub#3381 - it would be nice if we could stop specifying CLI args (by default) in Spawners, and do everything through the env, but it's trickier to remove than I realized. I would like to get to a point where JupyterHub internally does not turn any options into CLI args, other than explicit CLI args from user config, and only communicates options through the environment. Then this problem would go away, I think... |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/kubespawner-and-ldapauthentication-run-under-users-ldap-uid/8988/7 |
I think this issue is mostly resolved by the fact that jupyterhub 2.0 does not specify any CLI arguments, nor place any requirements on the CLI signature of the launch command, and never will again. That means that This simplifies the configuration explanation for z2jh in 2.0:
|
Thank you for clarifying things @minrk! I'm not yet comfortable with the situation about Renewed overview
Brainstorming
Related |
The default is less important to me; what's important to me is that the "use the image's command" case is clear and simple. If we can accomplish that, however we accomplish that, I'm okay with switching back to jupyterhub-singleuser to match other Spawners. Whatever we do with the default, I think it's probably still better for the z2jh approach to specify either the full
It doesn't make a difference in our case, but it's typical to set config either on the class that defines the trait, or on the subclass you know you are using. It makes no difference when there is only one class you are configuring, but if another class came up that was a sibling of KubeSpawner (inherits from Spawner but not KubeSpawner), there is a distinction:
That's mostly hypothetical in the current situation where there's really only one class to configure (or possible custom subclasses of KubeSpaner), so if things are clearer to set them on KubeSpawner only, that's okay, too. I would typically apply config to the class that defines the trait, though. Traitlets config loading looks through the class inheritance, so it'll find it on Spawner, KubeSpawner, or anything in between that has the trait (if there were something in between).
I guess we need to decide if we want to revert the "use image by default" change. If not, then document the two choices (singleuser.cmd or 'default'). If we go back to |
I saw that
c.KubeSpawner.default_url
was reported to not have an impact and decided to investigate.I end up concluding that configuring the command that the container starts with is very complicated. The Spawner, K8s, and the Dockerfile all have various names for similar things that all combine into a k8s containers
args
field where thecommand
field apparently isn't configurable to my surprise.cmd
,args
,notebook_dir
,default_url
, andget_args(...)
are defined in in the Spawner base classget_args(...)
combinesnotebook_dir
,default_url
, andargs
into a single appendix tocmd
. There are changes to this in JupyterHub version 2.0.0 though, see theget_args
definition.args
to the variablereal_cmd
decided below, which changed in 5ee6dc6. Note that in k8s manifestscommand
andargs
are the equivalent of Dockerfilesentrypoint
andcmd
.cmd
is[]
for z2jh >= 2.0.0 butjupyterhub-singleuser
for z2jh < 2.0.0. This means that by default, z2jh 2.0.0+ will expose this bug by default and silently ignoreargs
,notebook_dir
, ordefault_url
unlesscmd
is set explicitly as well. (Related PR: Unsetsingleuser.cmd
, previouslyjupyterhub-singleuser
, to instead rely on the image's CMD by default zero-to-jupyterhub-k8s#2449)Investigation conclusion
args
of the k8s container based on the traitletscmd
,args
,notebook_dir
,default_url
instead of settingcommand
tocmd
, and settingargs
todefault_url
,notebook_dir
andargs
.args
,notebook_dir
,default_url
whencmd
is unset is problematic and should lead to a warning at least.The text was updated successfully, but these errors were encountered: