Public method stop
should not be called from private method _start
#764
Labels
stop
should not be called from private method _start
#764
Proposed change
Reasoning
TL;DR: The
stop
method is assumed to only delete the JupyterLab server pod, although the inheritance contract should be that the method deletes any resources associated with the server.The current implemenation makes extending
KubeSpawner
with additional resources very difficult. It assumes that thestop
method just stops the JupyterLab server pod. This is, however, problematic in case additional Kubernetes resources are being cleared in an override of the methodstop
.The
stop
method is called for example here:kubespawner/kubespawner/spawner.py
Lines 2525 to 2533 in 0e5bb46
This is problematic since it's called from the
start
method. However, the overriddenstart
andstop
method might look something like this:In that case the call to
stop
also destroys the custom resources, although it should really just delete the pod.Alternative options
Who would use this feature?
Anyone creating a custom subclass of
KubeSpawner
which deploys additional Kubernetes resources in thestart
method.(Optional): Suggest a solution
Add a private
_stop
method and make the publicstop
method just a thin wrapper around the private method, similar to what's already done withstart
and_start
. Only call the_stop
method in the implementation.The text was updated successfully, but these errors were encountered: