Skip to content

Move the tar-split digest into the TOC#1902

Merged
openshift-merge-bot[bot] merged 5 commits intocontainers:mainfrom
mtrmac:tar-split-digest
May 16, 2024
Merged

Move the tar-split digest into the TOC#1902
openshift-merge-bot[bot] merged 5 commits intocontainers:mainfrom
mtrmac:tar-split-digest

Conversation

@mtrmac
Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac commented Apr 22, 2024

A minimal prototype for a fix of #1888 .

Note that this would immediately break pulling all currently-existing layers.

Also this probably increases memory requirements because the TOC exists as individual Go values longer.

Cc: @giuseppe

ManifestChecksumKey = "io.github.containers.zstd-chunked.manifest-checksum"
ManifestInfoKey = "io.github.containers.zstd-chunked.manifest-position"
TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum"
TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum" // Deprecated: Use the TOC.TarSplitDigest field instead, this one is not authenticated by ManifestChecksumKey.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it is fine if we just break now, and not have to worry about it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The alternative would be to ignore the tar-split. That would make the current images consumable, but they would IIRC break on re-pushing the layers.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented May 13, 2024

@giuseppe @mtrmac What should we do with this one?

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented May 13, 2024

#1888 must have a solution. This is one possible solution; it also breaks all currently-existing zstd:chunked images, which might be fine or very bad, I don’t know which one it is.

@giuseppe
Copy link
Copy Markdown
Member

giuseppe commented May 14, 2024

#1888 must have a solution. This is one possible solution; it also breaks all currently-existing zstd:chunked images, which might be fine or very bad, I don’t know which one it is.

It is fine to break these images now.

The tarsplit data must not be mandatory. If the tarsplit data is missing, we should just skip fetching it (and deal with errors to recreate the original image later)

mtrmac added 4 commits May 14, 2024 10:53
This is a microptimization, we call strings.ToLower only
once, but more importantly it will make it easier to add
more fields.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Other TOC formats don't fill the data in.

For now, this only increases memory usage, but we will
need the data soon.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... so that we can uniquely identify partially-pulled layers
by the TOC digest.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Include more details in the returned error text.

Don't continue in tests when we fail to obtain a TOC.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac mtrmac force-pushed the tar-split-digest branch from 791869f to 70b2454 Compare May 14, 2024 08:53
@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented May 14, 2024

With this PR:

  • If there is no tar-split offset, the image is accepted
  • If there is a tar-split offset and the new tar-split digest in the TOC, the image is accepted
  • If there is a tar-split offset and the TOC does not have the new digest, the image is rejected (most recently-created images are like this)

Alternatively, in the last case, we could accept the layer and ignore the tar-split data. If we do that, the images will continue to pull fine; but previously they also pushed fine and that would now break.

Marking ready for review now.

@mtrmac mtrmac marked this pull request as ready for review May 14, 2024 08:53
@giuseppe
Copy link
Copy Markdown
Member

  • If there is a tar-split offset and the TOC does not have the new digest, the image is rejected (most recently-created images are like this)

could we just drop it from the image generation and always ignore it? So we don't have to worry about it in future

Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

code LGTM

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented May 14, 2024

could we just drop it from the image generation and always ignore it? So we don't have to worry about it in future

I’m not sure which part you mean should be dropped. We need:

  • the offset to be provided somehow. Currently it is an annotation. (It could be in the TOC instead.)
  • a digest, in the TOC. (That’s being added in this PR. The previous digest, in the annotation, is still being added, but it is now ignored).

We can’t drop the tar-split offset. Do you mean to stop adding the TarSplitChecksumKey annotation? Something else?

@giuseppe
Copy link
Copy Markdown
Member

We can’t drop the tar-split offset. Do you mean to stop adding the TarSplitChecksumKey annotation? Something else?

yes, to stop doing that and use only the information in the TOC

We are already not reading it, so simplify the code.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented May 14, 2024

Done.

@mtrmac mtrmac changed the title RFC: Move the tar-split digest into the TOC Move the tar-split digest into the TOC May 14, 2024
Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented May 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, mtrmac

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented May 16, 2024

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants