Merge pull request #4610 from shahzzzam/samashah/add-annotations
Add manifest digest annotation for snapshotters
This commit is contained in:
commit
8ff2707a3c
@ -456,9 +456,12 @@ const (
|
|||||||
// targetRefLabel is a label which contains image reference and will be passed
|
// targetRefLabel is a label which contains image reference and will be passed
|
||||||
// to snapshotters.
|
// to snapshotters.
|
||||||
targetRefLabel = "containerd.io/snapshot/cri.image-ref"
|
targetRefLabel = "containerd.io/snapshot/cri.image-ref"
|
||||||
// targetDigestLabel is a label which contains layer digest and will be passed
|
// targetManifestDigestLabel is a label which contains manifest digest and will be passed
|
||||||
// to snapshotters.
|
// to snapshotters.
|
||||||
targetDigestLabel = "containerd.io/snapshot/cri.layer-digest"
|
targetManifestDigestLabel = "containerd.io/snapshot/cri.manifest-digest"
|
||||||
|
// targetLayerDigestLabel is a label which contains layer digest and will be passed
|
||||||
|
// to snapshotters.
|
||||||
|
targetLayerDigestLabel = "containerd.io/snapshot/cri.layer-digest"
|
||||||
// targetImageLayersLabel is a label which contains layer digests contained in
|
// targetImageLayersLabel is a label which contains layer digests contained in
|
||||||
// the target image and will be passed to snapshotters for preparing layers in
|
// the target image and will be passed to snapshotters for preparing layers in
|
||||||
// parallel. Skipping some layers is allowed and only affects performance.
|
// parallel. Skipping some layers is allowed and only affects performance.
|
||||||
@ -466,8 +469,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// appendInfoHandlerWrapper makes a handler which appends some basic information
|
// appendInfoHandlerWrapper makes a handler which appends some basic information
|
||||||
// of images to each layer descriptor as annotations during unpack. These
|
// of images like digests for manifest and their child layers as annotations during unpack.
|
||||||
// annotations will be passed to snapshotters as labels. These labels will be
|
// These annotations will be passed to snapshotters as labels. These labels will be
|
||||||
// used mainly by stargz-based snapshotters for querying image contents from the
|
// used mainly by stargz-based snapshotters for querying image contents from the
|
||||||
// registry.
|
// registry.
|
||||||
func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) containerdimages.Handler {
|
func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) containerdimages.Handler {
|
||||||
@ -486,8 +489,9 @@ func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) conta
|
|||||||
c.Annotations = make(map[string]string)
|
c.Annotations = make(map[string]string)
|
||||||
}
|
}
|
||||||
c.Annotations[targetRefLabel] = ref
|
c.Annotations[targetRefLabel] = ref
|
||||||
c.Annotations[targetDigestLabel] = c.Digest.String()
|
c.Annotations[targetLayerDigestLabel] = c.Digest.String()
|
||||||
c.Annotations[targetImageLayersLabel] = getLayers(ctx, targetImageLayersLabel, children[i:], labels.Validate)
|
c.Annotations[targetImageLayersLabel] = getLayers(ctx, targetImageLayersLabel, children[i:], labels.Validate)
|
||||||
|
c.Annotations[targetManifestDigestLabel] = desc.Digest.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user