Skip to content

Add the option to exclude certain layers from the tarball. - #209

Closed
mattmoor wants to merge 1 commit into
google:masterfrom
mattmoor:filterable-tarball
Closed

mattmoor wants to merge 1 commit into
google:masterfrom
mattmoor:filterable-tarball

Conversation

@mattmoor

Copy link
Copy Markdown
Collaborator

This should be considered a relatively advanced option, but for folks that know
what they are doing you can reduce the amount of data that you need to encode in
the tarball for the daemon to load it.

The ultimate use case of this option will be from daemon.Write, which
currently uses the docker load interface to pull image into the daemon,
however, this currently reuploads (and redownloads) the base image on each write
in context like ko. If we can determine the set of layers that already exist
in the daemon we can elide these from the tarball to dramatically improve
performance.

Related: #205

This should be considered a relatively advanced option, but for folks that know
what they are doing you can reduce the amount of data that you need to encode in
the tarball for the daemon to load it.

The ultimate use case of this option will be from `daemon.Write`, which
currently uses the `docker load` interface to pull image into the daemon,
however, this currently reuploads (and redownloads) the base image on each write
in context like `ko`. If we can determine the set of layers that already exist
in the daemon we can elide these from the tarball to dramatically improve
performance.

Related: google#205
@mattmoor
mattmoor requested a review from jonjohnsonjr June 10, 2018 21:56

@jonjohnsonjr jonjohnsonjr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm weakly -1 on this because I find it confusing. I would think we could fix the daemon.Write problem closer to the daemon?

Comment thread pkg/v1/tarball/write.go
// https://www.gnu.org/software/gzip/manual/html_node/Overview.html
layerFiles[i] = fmt.Sprintf("%s.tar.gz", hex)

// We filter late because the lenght of layerFiles must match the diff_ids

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: length

Comment thread pkg/v1/tarball/write.go
return err
}

// Default filter function

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe hoist this out into its own method?

Comment thread pkg/v1/tarball/write.go
return true, nil
}
if wo != nil {
if wo.LayerFilter != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Collapse this into if wo != nil && wo.LayerFilter != nil { ?

Though I guess that makes it harder to add more options... up to you.

@mattmoor

Copy link
Copy Markdown
Collaborator Author

@jonjohnsonjr I hear you, but at the same time, I'm not sure of a good way to do this closer to daemon.Write that doesn't also involve cloning a significant portion of tarball.Write.

@dlorenc

dlorenc commented Nov 2, 2018

Copy link
Copy Markdown
Contributor

can you rebase this?

@mattmoor

mattmoor commented Nov 9, 2018

Copy link
Copy Markdown
Collaborator Author

At this point, it's more work to rebase than redo. @jonjohnsonjr are you up for it?

@mattmoor mattmoor closed this Nov 9, 2018
jonjohnsonjr added a commit to jonjohnsonjr/go-containerregistry that referenced this pull request Oct 3, 2019
Continuation of this PR:
google#209

This should be considered a relatively advanced option, but for folks that know
what they are doing you can reduce the amount of data that you need to encode in
the tarball for the daemon to load it.

The ultimate use case of this option will be from daemon.Write, which
currently uses the docker load interface to pull image into the daemon,
however, this currently reuploads (and redownloads) the base image on each write
in context like ko. If we can determine the set of layers that already exist
in the daemon we can elide these from the tarball to dramatically improve
performance.

Related: google#205
jonjohnsonjr added a commit to jonjohnsonjr/go-containerregistry that referenced this pull request Oct 3, 2019
Continuation of this PR:
google#209

This should be considered a relatively advanced option, but for folks that know
what they are doing you can reduce the amount of data that you need to encode in
the tarball for the daemon to load it.

The ultimate use case of this option will be from daemon.Write, which
currently uses the docker load interface to pull image into the daemon,
however, this currently reuploads (and redownloads) the base image on each write
in context like ko. If we can determine the set of layers that already exist
in the daemon we can elide these from the tarball to dramatically improve
performance.

Related: google#205
jonjohnsonjr added a commit to jonjohnsonjr/go-containerregistry that referenced this pull request Nov 13, 2019
Continuation of this PR:
google#209

This should be considered a relatively advanced option, but for folks that know
what they are doing you can reduce the amount of data that you need to encode in
the tarball for the daemon to load it.

The ultimate use case of this option will be from daemon.Write, which
currently uses the docker load interface to pull image into the daemon,
however, this currently reuploads (and redownloads) the base image on each write
in context like ko. If we can determine the set of layers that already exist
in the daemon we can elide these from the tarball to dramatically improve
performance.

Related: google#205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants