mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #52161 from CaoShuFeng/kubectl_cp
Automatic merge from submit-queue (batch tested with PRs 52109, 52235, 51809, 52161, 50080). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Allow kubectl cp large amounts of files from container When we try to copy out a dir with large amounts of files from container, we hit such error: ```bash kubectl cp mypod:/ ./a/ tar: Removing leading `/' from member names tar: Removing leading `/' from hard link targets error: open a/usr/share/zoneinfo/Asia/Rangoon: too many open files ``` This is because kubectl opens too many files at the same. We should close them after Write() function. **Release note**: ``` NONE ```
This commit is contained in:
commit
90a4ac03dc
@ -259,8 +259,12 @@ func untarAll(reader io.Reader, destFile, prefix string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer outFile.Close()
|
if _, err := io.Copy(outFile, tarReader); err != nil {
|
||||||
io.Copy(outFile, tarReader)
|
return err
|
||||||
|
}
|
||||||
|
if err := outFile.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user