(ctx context.Context, client kubectl.Client, pod *k8sv1.Pod, container, containerPath string, writer io.Writer)
| 81 | } |
| 82 | |
| 83 | func downloadFromPod(ctx context.Context, client kubectl.Client, pod *k8sv1.Pod, container, containerPath string, writer io.Writer) error { |
| 84 | stderr := &bytes.Buffer{} |
| 85 | err := client.ExecStream(ctx, &kubectl.ExecStreamOptions{ |
| 86 | Pod: pod, |
| 87 | Container: container, |
| 88 | Command: []string{"tar", "czf", "-", containerPath}, |
| 89 | Stdout: writer, |
| 90 | Stderr: stderr, |
| 91 | }) |
| 92 | if err != nil { |
| 93 | return errors.Errorf("error executing tar: %s: %v", stderr.String(), err) |
| 94 | } |
| 95 | |
| 96 | return nil |
| 97 | } |
| 98 | |
| 99 | func getPrefix(file string) string { |
| 100 | // tar strips the leading '/' if it's there, so we will too |
no test coverage detected