(ctx context.Context, client kubectl.Client, pod *v1.Pod, container string, localPath string, containerPath string)
| 56 | } |
| 57 | |
| 58 | func upload(ctx context.Context, client kubectl.Client, pod *v1.Pod, container string, localPath string, containerPath string) error { |
| 59 | // do the actual copy |
| 60 | reader, writer := io.Pipe() |
| 61 | errorChan := make(chan error) |
| 62 | go func() { |
| 63 | defer reader.Close() |
| 64 | errorChan <- uploadFromReader(ctx, client, pod, container, containerPath, reader) |
| 65 | }() |
| 66 | go func() { |
| 67 | defer writer.Close() |
| 68 | errorChan <- makeTar(localPath, containerPath, writer) |
| 69 | }() |
| 70 | err := <-errorChan |
| 71 | // wait for the second goroutine to finish |
| 72 | <-errorChan |
| 73 | return err |
| 74 | } |
| 75 | |
| 76 | func uploadFromReader(ctx context.Context, client kubectl.Client, pod *v1.Pod, container, containerPath string, reader io.Reader) error { |
| 77 | cmd := []string{"tar", "xzp"} |
no test coverage detected