click
click copied to clipboard
Add one-off command
This command takes the image of the container of the current pod and runs the specified command in a one-off kubectl run command.
If the pod has multiple containers and none is specified, it will fail asking for the specific container.
I might have done some things wrong, so I'm really happy to receive feedback on this!
Implements https://github.com/databricks/click/issues/64 /cc @nicklan
Would be useful to have the env variables of the specified pod set as well.
The challenge with the env variables is, that there might be some variables from secrets and kubectl run
does not support this, see https://github.com/kubernetes/kubernetes/pull/48684. But there is a work around described here: https://github.com/kubernetes/kubernetes/pull/48684#issuecomment-342546951
This looks great! I'm just gonna test it out and then will leave comments and/or merge
@nicklan thanks for pointing that out. I added a method to sanitise the pod name.
I realised that the current implementation only allows one run command of the same image at the same time. A random sequence could be added to the K8s name so it does not fail for more run commands for the same pod/image at the same time.