Skip to content

Optimise sync #1641

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

Merged
merged 3 commits into from
Feb 14, 2019
Merged

Optimise sync #1641

merged 3 commits into from
Feb 14, 2019

Conversation

michaelfig
Copy link
Contributor

This PR implements steps 1 and 2 of #1639.

@michaelfig
Copy link
Contributor Author

Notably, the touch-after-sync is avoided by using the m flag to tar, which does the touch itself.

Maybe controversially, I added the --no-same-owner flag, which is the only thing that really makes sense to me when syncing a source file directly to a container.

@codecov-io
Copy link

codecov-io commented Feb 12, 2019

Codecov Report

Merging #1641 into master will decrease coverage by 0.05%.
The diff coverage is 61.53%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1641      +/-   ##
=========================================
- Coverage   46.95%   46.9%   -0.06%     
=========================================
  Files         119     119              
  Lines        5143    5151       +8     
=========================================
+ Hits         2415    2416       +1     
- Misses       2480    2487       +7     
  Partials      248     248
Impacted Files Coverage Δ
pkg/skaffold/sync/sync.go 91.3% <100%> (-0.13%) ⬇️
pkg/skaffold/util/tar.go 35.52% <41.17%> (-1.79%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c13adb...9623d54. Read the comment docs.

@r2d4 r2d4 added the kokoro:run runs the kokoro jobs on a PR label Feb 12, 2019
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Feb 12, 2019
Copy link
Contributor

@r2d4 r2d4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty great - haven't tried it out yet but just a few comments.

for _, dst := range files {
args = append(args, dst)
}
delete := exec.CommandContext(ctx, "kubectl", args...)
return []*exec.Cmd{delete}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both copyFn and deleteFn can just return a single exec.Cmd? WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No harm in leaving them as slices, but I'm indifferent.

if len(synced) != len(files) {
return errors.New("couldn't sync all the files in " + ns)
}
if numSynced == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this check makes sense anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this in to pass the "no copy" test at sync_test.go:410. If you want, both this and the test can be removed.

@balopat balopat merged commit 2536b83 into GoogleContainerTools:master Feb 14, 2019
@michaelfig michaelfig deleted the optimise-sync branch February 14, 2019 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants