mirror of
https://github.com/containerd/containerd.git
synced 2026-08-12 12:14:44 +00:00
Transfer Service: enable remote snapshotters
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/containerd/containerd/v2/core/transfer"
|
||||
"github.com/containerd/containerd/v2/core/unpack"
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
snpkg "github.com/containerd/containerd/v2/pkg/snapshotters"
|
||||
)
|
||||
|
||||
func (ts *localTransferService) pull(ctx context.Context, ir transfer.ImageFetcher, is transfer.ImageStorer, tops *transfer.Config) error {
|
||||
@@ -183,10 +184,14 @@ func (ts *localTransferService) pull(ctx context.Context, ir transfer.ImageFetch
|
||||
unpacks := iu.UnpackPlatforms()
|
||||
if len(unpacks) > 0 {
|
||||
uopts := []unpack.UnpackerOpt{}
|
||||
enableRemoteSnapshotAnnotations := false
|
||||
// Only unpack if requested unpackconfig matches default/supported unpackconfigs
|
||||
for _, u := range unpacks {
|
||||
matched, mu := getSupportedPlatform(u, ts.config.UnpackPlatforms)
|
||||
if matched {
|
||||
if v, ok := mu.SnapshotterExports["enable_remote_snapshot_annotations"]; ok && v == "true" {
|
||||
enableRemoteSnapshotAnnotations = true
|
||||
}
|
||||
uopts = append(uopts, unpack.WithUnpackPlatform(mu))
|
||||
}
|
||||
}
|
||||
@@ -199,6 +204,10 @@ func (ts *localTransferService) pull(ctx context.Context, ir transfer.ImageFetch
|
||||
uopts = append(uopts, unpack.WithDuplicationSuppressor(ts.config.DuplicationSuppressor))
|
||||
}
|
||||
|
||||
if enableRemoteSnapshotAnnotations {
|
||||
handler = snpkg.AppendInfoHandlerWrapper(name)(handler)
|
||||
}
|
||||
|
||||
unpacker, err = unpack.NewUnpacker(ctx, ts.content, uopts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to initialize unpacker: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user