ContainerConfig: Set ocispec.Annotations to containerConfig.Annotations

ocispec.Annotations is dropped in ContainerConfig.
This commit let it to be set to containerConfig.Annotations in
ContainerConfig.

Fixes: #2201

Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
Hui Zhu 2021-07-07 15:22:55 +08:00
parent 243d4b8689
commit 2c835b60ed

View File

@ -950,9 +950,7 @@ func ContainerConfig(ocispec specs.Spec, bundlePath, cid, console string, detach
RootFs: rootfs,
ReadonlyRootfs: ocispec.Root.Readonly,
Cmd: cmd,
Annotations: map[string]string{
vcAnnotations.BundlePathKey: bundlePath,
},
Annotations: ocispec.Annotations,
Mounts: containerMounts(ocispec),
DeviceInfos: deviceInfos,
Resources: *ocispec.Linux.Resources,
@ -961,6 +959,13 @@ func ContainerConfig(ocispec specs.Spec, bundlePath, cid, console string, detach
// to support ephemeral storage and k8s empty dir.
CustomSpec: &ocispec,
}
if containerConfig.Annotations == nil {
containerConfig.Annotations = map[string]string{
vcAnnotations.BundlePathKey: bundlePath,
}
} else {
containerConfig.Annotations[vcAnnotations.BundlePathKey] = bundlePath
}
cType, err := ContainerType(ocispec)
if err != nil {