Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Add buffering for large layers.#428

Merged
dlorenc merged 1 commit intoGoogleContainerTools:masterfrom
dlorenc:buffer
Nov 6, 2018
Merged

Add buffering for large layers.#428
dlorenc merged 1 commit intoGoogleContainerTools:masterfrom
dlorenc:buffer

Conversation

@dlorenc
Copy link
Copy Markdown
Contributor

@dlorenc dlorenc commented Nov 2, 2018

This writes layer tarballs to disk rather than keeping them all in memory.

#358

Comment thread pkg/executor/build.go Outdated
Comment thread pkg/snapshot/snapshot.go
// TakeSnapshot takes a snapshot of the specified files, avoiding directories in the whitelist, and creates
// a tarball of the changed files. Return contents of the tarball, and whether or not any files were changed
func (s *Snapshotter) TakeSnapshot(files []string) ([]byte, error) {
buf := bytes.NewBuffer([]byte{})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it looks like you decided to move this buffering up a layer - personally i think it's nicer for the caller not to have to worry about it but either way, maybe the commit message could go into some detail about why that choice was made?

Comment thread pkg/snapshot/snapshot_test.go
Comment thread pkg/executor/build.go Outdated
continue
}

f, err := ioutil.TempFile("/kaniko", "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there any case where we would want this to be in-memory instead? (i.e. configurable)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so - I think if anything the path itself here would be configurable. Using a tmp or memfs directory should be basically the same thing as in memory vs. on disk.

Copy link
Copy Markdown
Contributor Author

@dlorenc dlorenc left a comment

Choose a reason for hiding this comment

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

OK, cleaned this up quite a bit. Ready for another look.

Copy link
Copy Markdown
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

One nit, but otherwise LGTM!

Comment thread pkg/snapshot/snapshot.go Outdated
When building Docker images, layers were previously stored in memory.
This caused obvious issues when manipulating large layers, which could
cause Kaniko to crash.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants