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,17 +950,22 @@ func ContainerConfig(ocispec specs.Spec, bundlePath, cid, console string, detach
RootFs: rootfs, RootFs: rootfs,
ReadonlyRootfs: ocispec.Root.Readonly, ReadonlyRootfs: ocispec.Root.Readonly,
Cmd: cmd, Cmd: cmd,
Annotations: map[string]string{ Annotations: ocispec.Annotations,
vcAnnotations.BundlePathKey: bundlePath, Mounts: containerMounts(ocispec),
}, DeviceInfos: deviceInfos,
Mounts: containerMounts(ocispec), Resources: *ocispec.Linux.Resources,
DeviceInfos: deviceInfos,
Resources: *ocispec.Linux.Resources,
// This is a custom OCI spec modified at SetEphemeralStorageType() // This is a custom OCI spec modified at SetEphemeralStorageType()
// to support ephemeral storage and k8s empty dir. // to support ephemeral storage and k8s empty dir.
CustomSpec: &ocispec, CustomSpec: &ocispec,
} }
if containerConfig.Annotations == nil {
containerConfig.Annotations = map[string]string{
vcAnnotations.BundlePathKey: bundlePath,
}
} else {
containerConfig.Annotations[vcAnnotations.BundlePathKey] = bundlePath
}
cType, err := ContainerType(ocispec) cType, err := ContainerType(ocispec)
if err != nil { if err != nil {