click icon indicating copy to clipboard operation
click copied to clipboard

Add one-off command

Open peterfication opened this issue 6 years ago • 7 comments

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.

peterfication avatar Jun 16 '18 09:06 peterfication

I might have done some things wrong, so I'm really happy to receive feedback on this!

peterfication avatar Jun 16 '18 09:06 peterfication

Implements https://github.com/databricks/click/issues/64 /cc @nicklan

peterfication avatar Jun 25 '18 17:06 peterfication

Would be useful to have the env variables of the specified pod set as well.

peterfication avatar Jun 25 '18 18:06 peterfication

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

peterfication avatar Jul 07 '18 09:07 peterfication

This looks great! I'm just gonna test it out and then will leave comments and/or merge

nicklan avatar Aug 10 '18 17:08 nicklan

@nicklan thanks for pointing that out. I added a method to sanitise the pod name.

peterfication avatar Aug 12 '18 17:08 peterfication

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.

peterfication avatar Oct 08 '18 05:10 peterfication