-
Notifications
You must be signed in to change notification settings - Fork 304
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
Add kube profile spawner #137
Conversation
Hey, @gsemet! Apologies for the late review! This actually looks good to me as is! Can you merge it into KubeSpawner itself, rather than having it be a separate spawner? I think we can merge it afterwards... |
Sure. I just have one issue. When the container is pending stop and you want to restart it it shows a 400 error “pending stop”, I do not remember seeing it with the normal kubespawner, it was just waiting. |
86addb8
to
1338224
Compare
I have a few change to update (I'll do is asap) before this PR being ready to merge |
kubespawner/__init__.py
Outdated
|
||
__all__ = [KubeSpawner] | ||
__all__ = [KubeSpawner, KubeProfileSpawner] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably remove KubeProfileSpawner
from here now?
updated my PR. I'll be happy if someone can test it |
I'll test it tomorow on our baremetal kube cluster |
I took a look at this by adding the following to forked requirements.txt hub docker image: git+git://github.com/gsemet/kubespawner@profile_spawner#egg=jupyterhub-kubespawner And then in my config.yaml helm chart image:
name: govcloud/zero-to-jupyterhub-k8s
tag: v0.6
extraConfig: |
c.KubeSpawner.single_user_profile_list = [
{
'display_name': 'Training Env - Python',
'kubespawner_overrride': {
'image_spec': 'jupyterhub/python:0.8',
'cpu_limit': 10,
}
},
{
'display_name': 'Training Env - SAS',
'kubespawner_overrride': {
'image_spec': 'jupyterhub/sas:0.8',
'cpu_limit': 10,
}
}, {
'display_name': 'DataScience - Pachyderm',
'kubespawner_overrride': {
'image_spec': 'jupyterhub/pachyderm:0.8',
'cpu_limit': 10,
}
}
] The interface does get updated but doesn't seem to do anything? Looking at WrapSpawner + DockerSpawner are we not supposed to now check self.user_options before the make_pod assignment in kubespawner/kubespawner/objects.py Line 23 in f3a2637
Thanks for the amazing work! |
kubespawner/spawner.py
Outdated
|
||
options_form = Unicode() | ||
|
||
single_user_profile_list = List( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be profile_list
? I want to move toward removing the singleuser_
prefix from config, since everything here is necessarily about configuring singleuser pods, it's redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
kubespawner/spawner.py
Outdated
@@ -781,6 +783,46 @@ def _hub_connect_port_default(self): | |||
""" | |||
) | |||
|
|||
form_template = Unicode( | |||
"""<label for="profile">Please select a profile for your Jupyter:</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Jupyter/environment/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
kubespawner/spawner.py
Outdated
form_template = Unicode( | ||
"""<label for="profile">Please select a profile for your Jupyter:</label> | ||
<select class="form-control" name="profile" required autofocus> | ||
{input_template} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call this {inputs}
since it is not input_template, but the result of input_template being rendered multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
kubespawner/spawner.py
Outdated
the first item starts selected.""" | ||
) | ||
|
||
first_template = Unicode('selected', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this isn't a template, maybe not have 'template' in the name. Maybe first_input
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Ok, i'll rebase and test these changes next week :) |
Was there any feedback on my comment was curious for my own edification that this was still missing logic in make_pod to be functional? |
I have actually not tested the image spec override so I may have made a mistake. I’ll see that next week, prev week was too busy ! But sure, I’ll take all your feedback into account, and the image override should work, was a reason to implement this profile_list feature ! |
fb77366
to
e7c4735
Compare
@sylus, you took my example that had a typo: |
Just tested it now. It works :) I only tested with the following override:
And they are well applied on the started pod. |
kubespawner/spawner.py
Outdated
config=True, | ||
help="Text to substitute as {first} in inputs" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unintended whitespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be resolved
This looks great! the PR description example config should use |
updating with example in documentation |
16512fd
to
7eb0403
Compare
with this PR merged, it seems #108 can be done by subclassing kubespawner making the profile list dynamic based on auth_state? |
8ee1423
to
efb48ae
Compare
@gsemet I've made some changes. If this looks good to you, I'm happy to merge :) I highly appreciate your patience in getting this change through! |
/me approve ! |
Congratulations on getting this big patch merged in, @gsemet! And thank you for your patience in reworking based on feedback and waiting! |
thanks to you! I use it everyday, hope it will please others as much ! |
Any chance of getting this into the next release of zero-to-jupyterhub? |
tell me if you need test, i can do it pretty easily for now on our kube cluster |
Is this currently in the any of the jupyterhub helm-charts? |
@jgerardsimcock we are working on getting it into the Z2JH helm chart, but it isn't in there yet |
@choldgraf Any news/outlook on integrating this very useful update (congratulations, @gsemet !) into Z2JH Helm chart (I assume, v0.7)? @minrk said today (jupyterhub/zero-to-jupyterhub-k8s#545 (comment)) that this feature is already integrated, so double checking ... BTW, has v0.7 already been published as GA? |
Glad to see it is useful to others. ! |
@minrk 's opinion is usually more correct than mine, so I'll agree with him :-) |
@choldgraf What about the (general) availability of v0.7 Helm chart? |
|
Ah good summary @minrk! I'll put in work towards a helm chart release from now on. |
Reference #135
Adds
profile_list
parameter toKubeSpawner
allowing override of one or several parameter (ex: cpu_limit, image_spec, or any otherKubeSpawner
parameter)Here an example:
I have not fully tested this version, and if we agree, this class can be merged into
KubeSpawner
ultimately.Screenshot: