nydus icon indicating copy to clipboard operation
nydus copied to clipboard

Inject nydus annotation in manifest

Open hyy0322 opened this issue 2 years ago • 4 comments

Currently, Nydus Image label is in layers[n].annotations. In this format, harbor can not extract data. Annotation in manifest scope can be extracted. Here is an example.

{
    "schemaVersion":2,
    "mediaType":"application/vnd.docker.distribution.manifest.v2+json",
    "config":{
        "mediaType":"application/vnd.docker.container.image.v1+json",
        "digest":"sha256:a4e8c023d6c588e559e97ea11d6019d4672d5c03f1278501ce69b7434f9e7cf6",
        "size":6965
    },
    "layers":[
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:33a3351194b06f896afbed833460e70ba13f8f365dd8c328fa7778e2b5123e63",
            "size":33853195,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:254d6736795e373f9827f8c6c3d2e87256b4caab78ce1587066d1319214c537b",
            "size":25306316,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:15d807bafd0cb7129868b65a2015e1c9bd362fabac3f61f7027883cfe92808c9",
            "size":10311,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:d69d045ec1638270c3535a6ab5b3b61c87cc283900614c9d781311b250fb63c4",
            "size":10747,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:7184d286ddd035acd1f7d168bc0abe58d4c56c3b9dee0fa0c36a42605b88b498",
            "size":10554,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.oci.image.layer.nydus.blob.v1",
            "digest":"sha256:5eb438a98d738d42b95500ea1bd50a4508e7040057457ba6816945ed1744cb0d",
            "size":11234,
            "annotations":{
                "containerd.io/snapshot/nydus-blob":"true"
            }
        },
        {
            "mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip",
            "digest":"sha256:17a4bc16736f6c40ce67a228d8174a7cd454a4c23ddd75b7981698f5e8c236f0",
            "size":523604,
            "annotations":{
                "containerd.io/snapshot/nydus-bootstrap":"true",
                "containerd.io/snapshot/nydus-fs-version":"5"
            }
        }
    ],
    "subject":{
        "mediaType":"application/vnd.docker.distribution.manifest.v2+json",
        "digest":"sha256:f2fee5c7194cbbfb9d2711fa5de094c797a42a51aa42b0c8ee8ca31547c872b1",
        "size":1570
    },
  "annotations": {
    "com.example.key1": "value1",
    "com.example.key2": "value2"
  }
}

hyy0322 avatar Apr 28 '23 06:04 hyy0322

Do we need to attach other annotations besides identifying it as a nydus image?

imeoer avatar Apr 28 '23 07:04 imeoer

Do we need to attach other annotations besides identifying it as a nydus image?

Currently, No.

hyy0322 avatar May 17 '23 11:05 hyy0322

I will follow this issue

hyy0322 avatar May 22 '23 02:05 hyy0322

Disscussed with @imeoer ,we define annotation "containerd.io/snapshot/nydus": "true".

hyy0322 avatar May 22 '23 02:05 hyy0322

It's supported on latest nydusify/acceleration-service.

imeoer avatar Jun 18 '24 07:06 imeoer