-
Notifications
You must be signed in to change notification settings - Fork 801
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
schema: catch typos in template values using JSONSchema's additionalProperties
#2200
Conversation
additionalProperties
Awesome :) How do we test this against github.com/2i2c-org/pilot-hubs/ and github.com/berkeley-dsep-infra/datahub/? Their config is already public... |
@yuvipanda the easiest that I suggest is that we merge this and iterate after merge. The easiest form of test is to How to reference a non-merged chart?
How to test specifically against github.com/berkeley-dsep-infra/datahub/ for example?
|
@yuvipanda I tried this locally and the template validation worked fine, but when actually doing an upgrade I ran into a breaking change form a PR that I didn't think would be breaking. This is being addressed in #2201. |
@yuvipanda I brainfarted and didn't realize I could trial this myself. I tried the basehub Helm chart in pilot-hubs using the default values.
You can keep passing information to the hub pod through I also tried the How i tried it
|
With hhttps://github.com/jupyterhub/zero-to-jupyterhub-k8s/pull/2200, helm will default to not allowing arbitrary extra properties anywher except under jupyterhub.custom. This helps us move towards 1.0 Ref 2i2c-org#414
@yuvipanda this is now tested successfully against:
I'll do some work today that remains before we can cut 1.0.0-beta.1 but besides that work this is the remaining piece that I'd like to have merged for such beta release. |
Ref 2i2c-org#414 In preparation for strict schema validation of helm config from jupyterhub/zero-to-jupyterhub-k8s#2200
Sounds good to me! I don't have anywhere suitable to test this, but I trust @yuvipanda's review 😄 |
I'm very happy to have this! This is a breaking change though, since config that deployed earlier will no longer deploy. Can we document this as a breaking change? Happy to merge after that |
@yuvipanda I plan to put this in the CHANGELOG.md which is drafted in another PR currently. Would you like me to make a stub in the changelog from here and then merge them? PS: Test error in publish seems unrelated to |
Our schema.yaml file is rendered into values.schema.json and shipped with the Helm chart. It is a JSONSchema that covers all the configuration options or allows arbitrary configuration where it doesn't explicitly cover it. With this enabled we will catch almost all typos in values passed to the Helm chart, but on the other hand we will also cause some disruptions during `helm upgrade` commands before any changes has been made where we previously ignored configuration that wasn't recognized.
9ead768
to
1f31321
Compare
Preview of WIP of the changelog regarding breakign changes for this PR: https://github.com/consideRatio/zero-to-jupyterhub-k8s/blob/pr/12.0.0-release/CHANGELOG.md#breaking-changes
|
The test failure looks unrelated. THIS IS AWESOME, THANKS @consideRatio! |
Thank you @yuvipanda and @manics! ❤️ |
I'm working on upgrading from z2jh 0.11.1 to 1.2.0 and hit this error:
I think I can get around the The bigger issue I have is our deployment process runs Is the solution to just specify those in custom:
secrets_checksum: ''
values_checksum: '' It seems like this might be a decent advanced sub-topic for https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/customizing/extending-jupyterhub.html#applying-configuration-changes. |
Correct! All things not part of the chart, but you want to pass to as values so they can be accessed by the hub pod, should go there. Please extract anything else to a dedicated issue or discourse thread @mriedem, I didn't instantly understand your situation because it was a mix of things in it and I'm low on time atm. |
We have a
schema.yaml
file that we render intovalues.schema.json
and ship with our Helm chart as supported by Helm 3. This file is a JSONSchema that covers all our charts configuration options since #2033.helm
will use it duringhelm template
andhelm install|upgrade
to catch values that the schema considers invalid.What this PR does is to start make use of a JSONSchema feature called
additionalProperties
. WithadditionalProperties: false
we can make the schema invalidate anyobject
type field that declare a property that isn't declared in the schema.Since we have declared almost all properties, we can set
additionalProperties: false
on all thoseobject
type fields and catch all kinds of typos beforehelm install
,helm upgrade
, orhelm template
would start requesting changes to the k8s api-server.Closes #2199
Suggested action points
Example UX
Local testing