-
Notifications
You must be signed in to change notification settings - Fork 824
Add schema.yaml validation for extraFiles.data structure #2095
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
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
And prematurely apologies if this an 'obvious' error. Based on my tinkering however I think this is an actual error in _helpers.tpl. |
@roelbaz I can't reproduce this, and feel quite confident that the helm chart is given some configuration that has been invalid. It smells to me like an issue caused by for example terraform modifying the config in a faulty way. If it were an issue, it should be able to reproduce like this: # this works fine!
helm template hub1 jupyterhub --repo=https://jupyterhub.github.io/helm-chart/ --version=0.11.1-n301.hc86268b1 Technically, I think this is an error caused by a config like... hub:
extraFiles:
test: "hi" I can reproduce it like this... # this reproduce the error, but provides an invalid config
helm template hub1 jupyterhub --repo=https://jupyterhub.github.io/helm-chart/ --version=0.11.1-n301.hc86268b1 --set hub.extraFiles.test=string-here So, I assume this is a misconfiguration, and potentially caused by an external tool out of this helm charts control. I'll go ahead and close it for now but do followup if you can pinpoint this as an issue with the Helm chart. |
First of this is without any reference in the config.yaml to singleuser.extraFiles. (ie, not included whatsoever.) But given your suggestions in your response I'll tinker some and see if I can reproduce. Ultimately I'm after using extraFiles, but at this point I'm not even attempting that. |
Also thanks a whole bunch replying so quickly |
The error you get is associated with Helm template rendering, so it should be reproducible like... $ helm version
version.BuildInfo{Version:"v3.5.0", GitCommit:"32c22239423b3b4ba6706d450bd044baffdcf9e6", GitTreeState:"clean", GoVersion:"go1.15.6"}
# this should work, and does work for me
helm template hub1 jupyterhub --repo=https://jupyterhub.github.io/helm-chart/ --version=0.11.1-n301.hc86268b1 |
Thanks for the help/suggestions. Template command you gave me renders without error. Obviously have to dig, will let you know what I find. To be clear the helm config.yaml does work with 0.11.1 and 0.11.1-n082.h437ed29d (ie, just prior to PR #2006) |
@roelbaz okay then use |
I think I got it... it's the --set-file on the commandline screwing things up. I drop the --set-file and the extraFiles section in the config.yaml, and it loads. |
Hmmm... If you are using --set-file, you should probably use something else than |
You could have been given a better error message for this misconfiguration, so I'm reopening this issue as an issue about fixing schema.yaml to validate the hub|singleuser.extraFiles.data entries better. |
OK, confirmed my 'stupid' here: --set-file singleuser.extraFiles.sshConfig=./$HELM_CONFIG/files/ssh/config @consideRatio Thanks a whole bunch for your patience/help. |
We have a file called schema.yaml, it is a YAML representation of a JSONSchema, which is a format to validate data structures found in JSON/YAML for example. Here it is: zero-to-jupyterhub-k8s/jupyterhub/schema.yaml Lines 257 to 259 in c86268b
To better catch you error, we can trial with...
To do so, our extraFiles entry should look more like this instead (properties of extraFiles listed, and having some marked as required, and with their zero-to-jupyterhub-k8s/jupyterhub/schema.yaml Lines 474 to 506 in c86268b
@roelbaz, would you be interested in contributing a PR to fix this, updating schema.yaml to better help users catch this kind of error in the future? |
@consideRatio Yes I'll contribute a PR, give me ~24hrs or so. |
@roelbaz wiee! Do ping me if you feel stuck! Also btw I think we are better of by not adding the |
@consideRatio It'll be a bit more than 24hrs, as usual a bit too optimistic about my actual workload. |
❤️ ❤️ @roelbaz no preassure! |
Bug description
Template parsing error of the extraFile mountPath in:
jupyterhub/templates/_helpers.tpl:382:29: executing "jupyterhub.extraFiles.validate-file" at $file_details.mountPath>: can't evaluate field mountPath in type string
This was introduced in this PR: #2006
This is in versions 0.11.1-n113.hc841983b through 0.11.1-n301.hc86268b1 (Didn't try em all obviously, but those two are the 'bookends')
Expected behaviour
No parsing complaints from the _helpers.tpl
Actual behaviour
ubuntu@jhub-controller:~/jhub/kubernetes$
How to reproduce
Near as I can tell, a standard config.yaml for helm3 is going to provoke this.
Your personal set up
OS:
ubuntu@jhub-controller:~/jhub/kubernetes$ cat /etc/issue
Ubuntu 20.04.1 LTS \n \l
Configuration
Jupyterhub 1.3.0
Helm chart version: 0.11.1-n301.hc86268b1 (march 11th) but tried all the way back to 0.11.1-n113.hc841983b (feb 1st) when the aforementioned PR got introduced.
jupyterhub_config.py is unmodified from what is in the helm chart.
Logs
The text was updated successfully, but these errors were encountered: