Open consideRatio opened 2 years ago
As part of these changes do you think we could make part of https://github.com/jupyterhub/kubespawner/blob/6d6fc1d4b56715bf74764462b862bded63b14cb7/kubespawner/spawner.py#L1856-L1887 into a configurable Callable? E.g.
def get_expansions(self):
...
return dict(...)
template_expansions = Callable(default=get_expansions, config=True)
def _expand_user_properties(self, template):
rendered = template.format(**self.template_expansions())
return rendered.rstrip("-")
It would provide a way to revert any new expansions, and also means admins can add more (I saw a post/issue asking how to add addition expansions but I can't find it now)
https://github.com/jupyterhub/kubespawner/pull/653 expands this in labels, not sure if that was expanded (hah) to other properties.
Proposed change
As suggested by @yuvipanda in https://github.com/jupyterhub/kubespawner/pull/518#issuecomment-881583288: to expand strings containing
{username}
etc in all relevant configuration, wherever it may be.Alternative options
Who would use this feature?
Users of the expansion feature are many, and while it can be done with pre_spawn_hooks, it is hard to define more than a single one, so a Helm chart like binderhub shouldn't make use of these because then they would block the end users of configuring their own without overriding such logic.
Suggested action points
I suggest the next action points with regards to this feature proposal are to evaluate it further. The goal for me with such evaluation is to overview the value of implementing something like this and to overview the risk of causing disruptive experience through potential introducing of bugs or directly via a breaking change.
Without an overview like above concluding it is a valuable enough change to implement given the drawbacks, I favor the alternative option listed above - to add individual expansions one at the time.