-
Notifications
You must be signed in to change notification settings - Fork 247
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
chunked: support converting existing images #1673
Conversation
b006a54
to
14dbdf7
Compare
14dbdf7
to
32b4edd
Compare
@nalind @mtrmac @vrothberg PTAL |
What does this do, really? I don’t understand what “convert traditional images” means; Best I can tell this creates a “staging directory” for To the extent that this creates a |
the current code in The current PR instead enables It could be implemented in a more performant way where we pull the layer and handle directly the tarball stream, instead, the current implementation first converts the layer to the zstd:chunked format and then use the local copy with the existing code path. This is different than using |
So this is, a very likely completely temporary way to get data in a convenient format for creating composefs layers, until an implementation building the relevant file structure directly is built? And composefs images are going to be built via |
yes, the composefs images are built from |
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.
(A fairly brief look I’m afraid), code looks reasonable.
I’m a bit concerned about the code structure / lifetimes (how conversion is not done in GetDiffer
, how many fields in chunkedDiffer
are set to values that refer to a temporary file that will be gone by the time ApplyDiff
returns. Some of that might be inevitable if we don’t want to break external API, and I didn’t really check whether the internal data structures in this file could be restructured.
pkg/chunked/storage_linux.go
Outdated
|
||
c.fileType = fileTypeZstdChunked | ||
c.manifest = manifest | ||
c.convertToZstdChunked = false |
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.
Do I understand correctly that the conversion is deferred to ApplyDiff
primarily because the object returned by GetDiffer
does not have a Close
method that could be used to clean up?
But then… why set this to false
if fileSource
only lives for the duration of this function? If ApplyDiff
is ever called again (which… should not happen?), the conversion will need to be done again, won’t it?
I’d prefer sharing more code with makeZstdChunkedDiffer
, if this PR is not explicitly intended as a very short-term hack that will be completely reimplemented in a short order.
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.
I've dropped the c.convertToZstdChunked = false
as it is misleading, ApplyDiff
is not called recursively.
The conversion is deferred to ApplyDiff
mostly because GetDiffer
doesn't have access to the staging directory for the layer yet. In this way, we can write the temporary tar file there
if the "convert_images" option is set in the configuration file, then convert traditional images to the chunked format on the fly. This is very expensive at the moment since the entire zstd:chunked file is created and then processed. Signed-off-by: Giuseppe Scrivano <[email protected]>
if the image is created locally there is no need to validate again the files. Signed-off-by: Giuseppe Scrivano <[email protected]>
32b4edd
to
58405a5
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.
Thanks! LGTM, with the caveat that I haven’t kept up with the other changes over the last month, I’m afraid.
@rhatdan fine to merge? |
LGTM |
if the "convert_images" option is set in the configuration file, then convert traditional images to the chunked format on the fly.
This is very expensive at the moment since the entire zstd:chunked file is created and then processed.