mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
vendor: github.com/containerd/nydus-snapshotter v0.15.4
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
2
go.mod
2
go.mod
@@ -150,7 +150,7 @@ require (
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/go-cni v1.1.13 // indirect
|
||||
github.com/containerd/go-runc v1.1.0 // indirect
|
||||
github.com/containerd/nydus-snapshotter v0.15.2 // indirect
|
||||
github.com/containerd/nydus-snapshotter v0.15.4 // indirect
|
||||
github.com/containerd/plugin v1.0.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.17.0 // indirect
|
||||
github.com/containerd/ttrpc v1.2.7 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -149,8 +149,8 @@ github.com/containerd/go-runc v1.1.0 h1:OX4f+/i2y5sUT7LhmcJH7GYrjjhHa1QI4e8yO0gG
|
||||
github.com/containerd/go-runc v1.1.0/go.mod h1:xJv2hFF7GvHtTJd9JqTS2UVxMkULUYw4JN5XAUZqH5U=
|
||||
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
|
||||
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
||||
github.com/containerd/nydus-snapshotter v0.15.2 h1:qsHI4M+Wwrf6Jr4eBqhNx8qh+YU0dSiJ+WPmcLFWNcg=
|
||||
github.com/containerd/nydus-snapshotter v0.15.2/go.mod h1:FfwH2KBkNYoisK/e+KsmNr7xTU53DmnavQHMFOcXwfM=
|
||||
github.com/containerd/nydus-snapshotter v0.15.4 h1:l59kGRVMtwMLDLh322HsWhEsBCkRKMkGWYV5vBeLYCE=
|
||||
github.com/containerd/nydus-snapshotter v0.15.4/go.mod h1:eRJqnxQDr48HNop15kZdLZpFF5B6vf6Q11Aq1K0E4Ms=
|
||||
github.com/containerd/platforms v1.0.0-rc.2 h1:0SPgaNZPVWGEi4grZdV8VRYQn78y+nm6acgLGv/QzE4=
|
||||
github.com/containerd/platforms v1.0.0-rc.2/go.mod h1:J71L7B+aiM5SdIEqmd9wp6THLVRzJGXfNuWCZCllLA4=
|
||||
github.com/containerd/plugin v1.0.0 h1:c8Kf1TNl6+e2TtMHZt+39yAPDbouRH9WAToRjex483Y=
|
||||
|
||||
1
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/constant.go
generated
vendored
1
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/constant.go
generated
vendored
@@ -8,6 +8,7 @@ package converter
|
||||
|
||||
const (
|
||||
ManifestOSFeatureNydus = "nydus.remoteimage.v1"
|
||||
ManifestConfigNydus = "application/vnd.nydus.image.config.v1+json"
|
||||
MediaTypeNydusBlob = "application/vnd.oci.image.layer.nydus.blob.v1"
|
||||
BootstrapFileNameInLayer = "image/image.boot"
|
||||
|
||||
|
||||
37
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/convert_unix.go
generated
vendored
37
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/convert_unix.go
generated
vendored
@@ -117,6 +117,12 @@ func unpackOciTar(ctx context.Context, dst string, reader io.Reader) error {
|
||||
return errors.Wrap(err, "apply with convert whiteout")
|
||||
}
|
||||
|
||||
// Read any trailing data for some tar formats, in case the
|
||||
// PipeWriter of opposite side gets stuck.
|
||||
if _, err := io.Copy(io.Discard, ds); err != nil {
|
||||
return errors.Wrap(err, "trailing data after applying archive")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -815,6 +821,10 @@ func makeBlobDesc(ctx context.Context, cs content.Store, opt PackOption, sourceD
|
||||
// a nydus blob layer, and set the media type to "application/vnd.oci.image.layer.nydus.blob.v1".
|
||||
func LayerConvertFunc(opt PackOption) converter.ConvertFunc {
|
||||
return func(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) {
|
||||
if ctx.Err() != nil {
|
||||
// The context is already cancelled, no need to proceed.
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
if !images.IsLayerType(desc.MediaType) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -864,13 +874,28 @@ func LayerConvertFunc(opt PackOption) converter.ConvertFunc {
|
||||
return nil, errors.Wrap(err, "pack tar to nydus")
|
||||
}
|
||||
|
||||
copyBufferDone := make(chan error, 1)
|
||||
go func() {
|
||||
defer pw.Close()
|
||||
buffer := bufPool.Get().(*[]byte)
|
||||
defer bufPool.Put(buffer)
|
||||
if _, err := io.CopyBuffer(tw, tr, *buffer); err != nil {
|
||||
pw.CloseWithError(err)
|
||||
_, err := io.CopyBuffer(tw, tr, *buffer)
|
||||
copyBufferDone <- err
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer pw.Close()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// The context was cancelled!
|
||||
// Close the pipe with the context's error to signal
|
||||
// the reader to stop.
|
||||
pw.CloseWithError(ctx.Err())
|
||||
return
|
||||
case err := <-copyBufferDone:
|
||||
if err != nil {
|
||||
pw.CloseWithError(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := tr.Close(); err != nil {
|
||||
pw.CloseWithError(err)
|
||||
@@ -1016,6 +1041,12 @@ func convertManifest(ctx context.Context, cs content.Store, oldDesc ocispec.Desc
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "write image config")
|
||||
}
|
||||
// When manifests are merged, we need to put a special value for the config mediaType.
|
||||
// This values must be one that containerd doesn't understand to ensure it doesn't try tu pull the nydus image
|
||||
// but use the OCI one instead. And then if the nydus-snapshotter is used, it can pull the nydus image instead.
|
||||
if opt.MergeManifest {
|
||||
newConfigDesc.MediaType = ManifestConfigNydus
|
||||
}
|
||||
manifest.Config = *newConfigDesc
|
||||
// Update the config gc label
|
||||
manifestLabels[configGCLabelKey] = newConfigDesc.Digest.String()
|
||||
|
||||
3
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/types.go
generated
vendored
3
vendor/github.com/containerd/nydus-snapshotter/pkg/converter/types.go
generated
vendored
@@ -127,6 +127,9 @@ type MergeOption struct {
|
||||
Encrypt Encrypter
|
||||
// AppendFiles specifies the files that need to be appended to the bootstrap layer.
|
||||
AppendFiles []File
|
||||
// MergeManifest indicates that the resulting nydus manifest will be merged with the original
|
||||
// OCI one into a single index manifest.
|
||||
MergeManifest bool
|
||||
}
|
||||
|
||||
type UnpackOption struct {
|
||||
|
||||
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@@ -454,8 +454,8 @@ github.com/containerd/go-runc
|
||||
## explicit; go 1.20
|
||||
github.com/containerd/log
|
||||
github.com/containerd/log/logtest
|
||||
# github.com/containerd/nydus-snapshotter v0.15.2
|
||||
## explicit; go 1.22.0
|
||||
# github.com/containerd/nydus-snapshotter v0.15.4
|
||||
## explicit; go 1.24.0
|
||||
github.com/containerd/nydus-snapshotter/pkg/converter
|
||||
github.com/containerd/nydus-snapshotter/pkg/converter/tool
|
||||
github.com/containerd/nydus-snapshotter/pkg/label
|
||||
|
||||
Reference in New Issue
Block a user