It'd be nice for users to have a way to replicate their user pod in the job pod so they could access all their data similarly to how they would if they were running in their Jupyterhub user pod. I'd propose the addition of a --replicateUserPod flag which would cause the initContainers, volumes, volumeMounts, and image of the user pod to be added to the job pod. This might be implemented in the following way:
- user submits job
kbatch submit job --replicateUserPod ...
- then kbatch client looks for
socket.gethostname() to find what pod we're in, and passes hostname to kbatch-proxy
- kbatch-proxy calls
kubernetes.client.CoreV1Api().read_namespaced_pod(hostname, namespace) to get pod spec
- pulls out
initContainers, volumes, volumeMounts, image and add these to spec of job pod to be submitted
- kbatch-proxy submits job otherwise the same as it does currently