Add OCI annotations for container name
Along with type(Sandbox or Container) and Sandbox name annotations provide support for additional annotation: - Container name This will help us perform per container operation by comparing it with pass through annotations (eg. pod metadata annotations from K8s) Signed-off-by: Chethan Suresh <Chethan.Suresh@sony.com>
This commit is contained in:
@@ -68,6 +68,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
||||
if metadata == nil {
|
||||
return nil, errors.New("container config must include metadata")
|
||||
}
|
||||
containerName := metadata.Name
|
||||
name := makeContainerName(metadata, sandboxConfig.GetMetadata())
|
||||
log.G(ctx).Debugf("Generated id %q for container %q", id, name)
|
||||
if err = c.containerNameIndex.Reserve(name, id); err != nil {
|
||||
@@ -147,7 +148,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
||||
}
|
||||
log.G(ctx).Debugf("Use OCI runtime %+v for sandbox %q and container %q", ociRuntime, sandboxID, id)
|
||||
|
||||
spec, err := c.containerSpec(id, sandboxID, sandboxPid, sandbox.NetNSPath, config, sandboxConfig,
|
||||
spec, err := c.containerSpec(id, sandboxID, sandboxPid, sandbox.NetNSPath, containerName, config, sandboxConfig,
|
||||
&image.ImageSpec.Config, append(mounts, volumeMounts...), ociRuntime)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to generate container %q spec", id)
|
||||
|
||||
Reference in New Issue
Block a user