-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugtool: Compress and copy with resume #671
Conversation
This commit is to add gzip compression for cilium-bugtool to reduce size of transferred file. In local cluster, the size is reduced significantly (e.g. from 21 MB to ~3MB). Once copied to local system, this file is extracted again so that there is no change in existing behavior. ``` root@kind-control-plane:/tmp# ls -lrth cilium-bugtool-20211224-072* -rw-r--r-- 1 root root 21M Dec 24 07:20 cilium-bugtool-20211224-072047.092+0000-UTC-1266452003.tar -rw-r--r-- 1 root root 3.1M Dec 24 07:21 cilium-bugtool-20211224-072122.815+0000-UTC-2647778632.tar.gz ``` Relates to cilium#616 (comment) Signed-off-by: Tam Mach <[email protected]>
9db18bd
to
a81b815
Compare
This commit is to add CopyFromPod function in current k8s client, which supports resuming copy from last byte offset. Small refactor for exec in pod method was done to avoid copying reader multiple times. Relates to cilium#616 (comment) Signed-off-by: Tam Mach <[email protected]>
a81b815
to
a0aa326
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one non-blocking comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the late review, but there are a couple of nits.
@@ -0,0 +1,46 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
// Copyright 2020 Authors of Cilium |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The copyright year should be 2021. This also applies to other files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad :(
outFile, err := os.Create(destFile) | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is missing a defer outFile.Close()
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, I forgot about this most of the time, and relying on linters. If I am not wrong, file is having finalizer i.e. fd will be garbage collected later, not idea in case of reuse of file descriptor.
Let me make a small update on this, thanks again.
This commit is to correct/add header with year 2022 for new files. Relates cilium#671 (comment)
This commit is to correct/add header with year 2022 for new files. Relates cilium#671 (comment) Signed-off-by: Tam Mach <[email protected]>
This commit is to correct/add header with year 2022 for new files. Relates #671 (comment) Signed-off-by: Tam Mach <[email protected]>
This commit is to correct/add header with year 2022 for new files. Relates cilium#671 (comment) Signed-off-by: Tam Mach <[email protected]>
This commit is to correct/add header with year 2022 for new files. Relates cilium/cilium-cli#671 (comment) Signed-off-by: Tam Mach <[email protected]>
Description
This PR tries to address the below points mentioned in #616
Changes
Please refer to individual commit for more details
Testing
Testing was done as per below
Make sure that the existing functionalities still working
Testing with a very large file (~10GB before compressed, 50MB after compressed)