-
Notifications
You must be signed in to change notification settings - Fork 1.2k
util/estargz: simplify implementation and define consts for labels #5933
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
base: master
Are you sure you want to change the base?
Conversation
// [estargz.StoreUncompressedSizeAnnotation]: https://pkg.go.dev/github.com/containerd/stargz-snapshotter/estargz@v0.16.3#StoreUncompressedSizeAnnotation | ||
StoreUncompressedSizeAnnotation = "io.containers.estargz.uncompressed-size" |
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.
Curious why this uses a different prefix (io.containers.estargz
) than the other ones, which all use containerd.io/..
😅
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.
This is because this annotation is necessary to make the filesystem work with github.com/containers/storage
library which is used by Podman/CRI-O. c.f. https://github.com/containerd/stargz-snapshotter/blob/2f71f9ea81620e302c5ec6384597fc630fbc6656/estargz/types.go#L78-L82
if err := labels.Validate(TargetImageLayersLabel, layers+l.Digest.String()); err != nil { | ||
break | ||
} | ||
layers += ls | ||
layers += l.Digest.String() + "," |
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.
Slight change here; previously this would check the length including the trailing ,
, but when setting the label, we trim the trailing comma, so there would be a potential off-by-one here, where we'd skip the label for being too long, even if it wasn't?
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.
// This annotation is valid only when it is specified in `.[]layers.annotations` | ||
// of an image manifest. | ||
// | ||
// This is a copy of [estargz.TOCJSONDigestAnnotation] |
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.
Why isn't this imported (or upstream constant just used instead). Same for next.
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 went back-and-forth a bit; initially I had these as alias (TOCJSONDigestAnnotation = estargz.TOCJSONDigestAnnotation
), but as we already would have to define the non-exported ones locally (and the estargz
package containing much more than just the consts), and these consts to not change, I thought it would be OK to just have our own copy, as long as we refer to where they originate from.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
No description provided.