devopsspiral/KubeLibrary

Add support for the copy command (kubectl cp)

Opened this issue · 2 comments

It would be great if this library could support the copy command to copy files to a pod. I foresee this keyword needing to know the following information (arguments):

  • Namespace
  • Filename(s) to copy
  • Source Path (local)
  • Destination Path (on the pod)
  • Pod Name (the name of the pod to copy the files to)
  • Timeout (the maximum length of time to wait before erroring out and moving on)

Hi @sparkymartin,
please have a look at my PR #84
kubectl cp seems to be using the same functionality as kubectl exec. I added a few examples as test cases to show how it can be used. This one is basically copying a file from a container: https://github.com/Nilsty/KubeLibrary/blob/e164476a591feab884afb3cf16a5c04982c228cc/testcases/pod/pod_exec.robot#L29

I have not implemented a timeout handling, but it would be interesting to know if this implementation goes into the right direction and would be any use for you.

Thanks,
Nils

@Nilsty that is a good idea, however what about binary files? I can take this task, if there is sufficient API ;-)