Skip to content

Commit

Permalink
ContainerConfig: Set ocispec.Annotations to containerConfig.Annotations
Browse files Browse the repository at this point in the history
ocispec.Annotations is dropped in ContainerConfig.
This commit let it to be set to containerConfig.Annotations in
ContainerConfig.

Fixes: kata-containers#2201

Signed-off-by: Hui Zhu <teawater@antfin.com>
  • Loading branch information
teawater committed Jul 13, 2021
1 parent cd524c6 commit dd55ec8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/runtime/virtcontainers/pkg/oci/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,17 +950,22 @@ 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,
},
Mounts: containerMounts(ocispec),
DeviceInfos: deviceInfos,
Resources: *ocispec.Linux.Resources,
Annotations: ocispec.Annotations,
Mounts: containerMounts(ocispec),
DeviceInfos: deviceInfos,
Resources: *ocispec.Linux.Resources,

// This is a custom OCI spec modified at SetEphemeralStorageType()
// 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 {
Expand Down

0 comments on commit dd55ec8

Please sign in to comment.