-
Notifications
You must be signed in to change notification settings - Fork 391
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
support extraFiles for binderhub pod #1472
Conversation
- top-level templates is dict of filename: contents, e.g. "page.html": "{% extends "templates/page.html" %}" - mount custom templates dir in /etc/binderhub/templates Existing template config already supports this, so it's just making the files available we need.
Hm, we have a problem in CI because it's now impossible to update the helm schema and pass tests, because the same config is passed both to the current and previous version of binderhub. If the schema weren't so strict (i.e. rejecting addtionalProperties), this would be less of an issue. |
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 seems like a nice and relatively lightweight way to add this functionality without increasing our configuration surface area each time we want another page / section to be extensible...though we should probably improve our documentation around how to do this because many people may not be familiar with the template names they should use for over-riding etc...
This seems like I'm probably not willing to invest my own time into this effort at the moment so please go ahead with this template specific approach if you think it makes sense. I know for z2jh it was just one use case to mount templates while mounting configuration files etc would also be relevant, due to that we developed this more general support both for the hub pod and user pods. Overall, this feature seems to have been a great success.
|
- install an extra 'old' yaml config when installing against an old binderhub version - this file should only exist during PRs that change the schema, delete immediately after merging
It is! I actually used your extraFiles implementation as reference. JupyterHub is much more infinitely extensible, so there are more general files that make sense to drop-in, especially files we as chart maintainers don't need to know about. I'm not sure I see a similar arbitrary files use case in BinderHub, so I thought this would be simpler, both to implement (the whole thing is smaller than just the helpers for extraFiles) and use (deployments don't need to know where we put templates). On the other hand, I can imagine expert JupyterHub deployers (and maintainers) liking the familiarity of extraFiles consistently applied everywhere. |
This now imports extraFiles exactly as-is (thanks for the links @consideRatio), so the feature is consistent across jupyterhub/binderhub. |
FWIW, I couldn't figure out how to add a simple test that would only run on the full k8s case to verify that the custom template has its effect. I did verify it with a manual deploy (haven't yet with extraFiles, will do that tomorrow). |
{{- with include "binderhub.extraFiles.stringData" .Values.extraFiles }} | ||
{{- . | nindent 2 }} | ||
{{- end }} | ||
|
||
{{- with include "binderhub.extraFiles.data" .Values.extraFiles }} | ||
data: | ||
{{- . | nindent 2 }} | ||
{{- end }} |
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.
Did you know/consider this option? The helpers seems general enough to function without being hard-copied to this helm chart, and are practically available in the helm chart already.
{{- with include "binderhub.extraFiles.stringData" .Values.extraFiles }} | |
{{- . | nindent 2 }} | |
{{- end }} | |
{{- with include "binderhub.extraFiles.data" .Values.extraFiles }} | |
data: | |
{{- . | nindent 2 }} | |
{{- end }} | |
{{- with include "jupyterhub.extraFiles.stringData" .Values.extraFiles }} | |
{{- . | nindent 2 }} | |
{{- end }} | |
{{- with include "jupyterhub.extraFiles.data" .Values.extraFiles }} | |
data: | |
{{- . | nindent 2 }} | |
{{- end }} |
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 will try that! I thought of it, but then wasn't sure about versions, etc. I will try it that way tomorrow
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.
Since binderhub pins the version of JupyterHub being the dependency, this feels quite safe. Since the helpers are general enough, I'm not worried about having binderhub starting to use this - at least no more worried than needing to update the code in two places if it improves.
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 I just check, is this considered a supported use of Z2JH chart features (which therefore will be maintained in accordance with semver)?
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 have two answers for that:
- I would not consider any helpers in any chart public APIs, unless thoroughly documented to be otherwise
- I would not consider binderhub an 'external' project, so I'm okay using these kinds of internal utilities across our internal projects, especially with the strict dependency pin we use in binderhub. If jupyterhub ever breaks this, we can vendor the previous version with a copy/paste or update.
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.
tested and works great with the imported helpers
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 appreciate the answers above about "not documented -> no commitment" and the distinction about what we recommend using to others and what we do internally.
@manics do you see an action point that would make you feel comfortable around this? Perhaps a declaration of intent for how helpers are used in z2jh? I think being explicit about such intent is fine, especially since I'm unsure about what helpers we should couple to be tracked by the changelog etc.
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.
It's related to the idea behind dogfooding: https://en.m.wikipedia.org/wiki/Eating_your_own_dog_food
We know JupyterHub and Z2JH are used and extended by lots of users, many who we have no idea about, and BinderHub is a prime demonstration of how to build on top of Z2JH. If we're running into issues with extending Z2JH then it's probable that others will too. I think we should therefore aim to do whatever we'd tell others to do. I can't tell from this discussion what the feeling was- say it's acceptable for everything else to do this with the proviso that it's not a standard API, or try and keep it hidden from everyone?
Given the time pressure it's fine to merge this, but if the conclusion of the above discussion is that this shouldn't be copied by other applications then maybe create an issue for how to come up with a public solution?
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.
Just chiming it that while I don't consider them public now that doesn't mean they necessarily shouldn't be - if we want to support downstream charts using extraFiles, I think the first step is adding them to the z2jh docs.
I've also failed to make a simple test, but here is an overview of what I did in z2jh in case you wish to implement a test like that.
I think this is inevitable to avoid issues during upgrade tests without having separate configurations. This is how I've resolved it in z2jh:
The GitHub Workflow testing the charts always run a step referencing
Its strictness can be troublesome here, but is one of the key values of the schema I think. Rejecting unrecognized property names has helped a lot of users catch invalid configuration I believe, and also reduced the maintenance by fewer bugs being reported by invalid configuration caused by typos. |
more complex, but also more general helpers are imported from the jupyterhub chart!
I went with a simple test under |
Looks like I wasn't quite right about the condition, trying a fix |
opt-in test, only run when --helm is given
New test (new |
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.
LGTM besides comment with regards to removal of pytest mark.
jupyterhub/binderhub#1472 Merge pull request #1472 from minrk/helm-templates
imports extraFiles helpers, spec from JupyterHub, applied to the binderhub pod
Possibly more general solution to #1471