Skip to content

Commit 8ff2707

Browse files
authored
Merge pull request #4610 from shahzzzam/samashah/add-annotations
Add manifest digest annotation for snapshotters
2 parents 619f96c + 5fc7213 commit 8ff2707

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

pkg/cri/server/image_pull.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,21 @@ const (
456456
// targetRefLabel is a label which contains image reference and will be passed
457457
// to snapshotters.
458458
targetRefLabel = "containerd.io/snapshot/cri.image-ref"
459-
// targetDigestLabel is a label which contains layer digest and will be passed
459+
// targetManifestDigestLabel is a label which contains manifest digest and will be passed
460460
// to snapshotters.
461-
targetDigestLabel = "containerd.io/snapshot/cri.layer-digest"
461+
targetManifestDigestLabel = "containerd.io/snapshot/cri.manifest-digest"
462+
// targetLayerDigestLabel is a label which contains layer digest and will be passed
463+
// to snapshotters.
464+
targetLayerDigestLabel = "containerd.io/snapshot/cri.layer-digest"
462465
// targetImageLayersLabel is a label which contains layer digests contained in
463466
// the target image and will be passed to snapshotters for preparing layers in
464467
// parallel. Skipping some layers is allowed and only affects performance.
465468
targetImageLayersLabel = "containerd.io/snapshot/cri.image-layers"
466469
)
467470

468471
// appendInfoHandlerWrapper makes a handler which appends some basic information
469-
// of images to each layer descriptor as annotations during unpack. These
470-
// annotations will be passed to snapshotters as labels. These labels will be
472+
// of images like digests for manifest and their child layers as annotations during unpack.
473+
// These annotations will be passed to snapshotters as labels. These labels will be
471474
// used mainly by stargz-based snapshotters for querying image contents from the
472475
// registry.
473476
func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) containerdimages.Handler {
@@ -486,8 +489,9 @@ func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) conta
486489
c.Annotations = make(map[string]string)
487490
}
488491
c.Annotations[targetRefLabel] = ref
489-
c.Annotations[targetDigestLabel] = c.Digest.String()
492+
c.Annotations[targetLayerDigestLabel] = c.Digest.String()
490493
c.Annotations[targetImageLayersLabel] = getLayers(ctx, targetImageLayersLabel, children[i:], labels.Validate)
494+
c.Annotations[targetManifestDigestLabel] = desc.Digest.String()
491495
}
492496
}
493497
}

0 commit comments

Comments
 (0)