-
Notifications
You must be signed in to change notification settings - Fork 382
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
Move custom BinderSpawner config to traitlets #1351
Conversation
@consideRatio you might like this, given it removes entries from custom config and moves them towards something with a better defined schema :) |
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.
I think this is an absolutely great refactoring, it embeds logic in the Helm chart to the Python code in BinderHub application running in the binder
pod and the BinderSpawner running in the hub
pod. Nice!
There is a question about how to handle this as a breaking change though. I wouldn't hesitate merging if you went for a NOTES.txt rendered message if someone was passing anything to the deprecated Helm chart config values still. To do that, first make sure the schema tolerates that. In practice, I figure:
- Let values.yaml define a blank entry still.
- Let schema still list it under properties so
additionalProperties: false
can be used, but remove it from being an required entry. - Let NOTES.txt check if the dictionary is truthy, then print a message and pipe it to
fail
.
I'd like to see the pattern used in Z2JH's NOTES.txt be reused for this as it makes it very clear.
@consideRatio I think I've done the changes you have asked for! Very nice way to make breaking changes, thanks for building out the system and pointing me to it! |
89488b9
to
e0ec169
Compare
Reduces reliance on z2jh specific features for the BinderSpawner. Eventually it should be made into just a mixin.
e0ec169
to
cf2b2d0
Compare
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.
Minor fix, otherwise LGTM.
helm-chart/binderhub/schema.yaml
Outdated
# Deprecated | ||
cors: | ||
type: object | ||
additionalProperties: false |
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.
additionalProperties: false | |
additionalProperties: true |
Without this being true, a user won't be able to get informed via our NOTES.txt, because helm will fail even before that if someone passed something nested under this.
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.
@yuvipanda i dont think you tested the deprecation logic, this must allow unlisted properties as well i think!
Can you also set the additionalProperties to true explicitly on the other deprecated entry for consistency of having an explicit choice for all our objects?
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.
Doing this, and you can test the deprecation logic
tools/generate-schema...
helm template bh helm-chart/binderhub --set cors.stuff=...
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.
Resolved by my small schema fixes commit.
@yuvipanda i reviewed and then i saw a force push making my review potentially irrelevant, not sure what changed - I'll assume I won't need to re-view it and there was just some small detail. |
rbac: | ||
enabled: true | ||
hub: | ||
config: | ||
JupyterHub: | ||
authenticator_class: nullauthenticator.NullAuthenticator | ||
BinderSpawner: | ||
auth_enabled: false |
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.
A quick clarification regarding this: Will this break downstream packages which define custom Spawners and not use BinderSpawner?
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.
Depends, what do they inherit from? If they inherit from BinderSpawner, everything should be fine I think.
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.
This config is like writing c.BinderSpawner.auth_enabled = False
and will influence a MyCustomBinderSpawner class as well as long as it inherits from BinderSpawner
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.
Note there is a helpful message during this breaking upgrade.
During an upgrade, you will be prompted that Helm chart config setting if auth is enabled or not should be done with new properties - namely this.
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.
Thanks! We inherit from KubeSpawner
so need to fix that up for Persistent BinderHub :)
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.
Test failure is relevant!
909027c
to
5d4f173
Compare
5d4f173
to
5333692
Compare
@consideRatio test failures fixed! |
I went ahead and tested the schema after making some tweaks, and pushed a commit. This now LGTM.
|
jupyterhub/binderhub#1351 Merge pull request #1351 from yuvipanda/cors-allow
Thanks a lot, @consideRatio! Feels good to be writing code for binderhub again :) |
Currently, we have two config variables that are specified in
jupyterhub.custom
so they can be read by code in the JupyterHub custom config. However, we can
do this in a much more structured way by using actual traitlets. Better validation,
documentation and 'cleaner'.
This also helps move config away from z2jh specific things (
z2jh.get_config
)towards the more generic traitlets.