KubeLibrary icon indicating copy to clipboard operation
KubeLibrary copied to clipboard

Add support for the copy command (kubectl cp)

Open sparkymartin opened this issue 3 years ago • 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)

sparkymartin avatar Jun 24 '21 17:06 sparkymartin

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 avatar Jul 12 '21 21:07 Nilsty

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

MarcinMaciaszek avatar Dec 08 '21 14:12 MarcinMaciaszek