[cri] use 'UserSpecifiedImage' to set the image-name annotation
However, when an image has multiple tags, the image originally obtained may not be the one actually specified by the user. Starting from cri-api v0.28.0, a UserSpecifiedImage field is added to ImageSpec. It is more appropriate to use UserSpecifiedImage. Signed-off-by: jinda.ljd <jinda.ljd@alibaba-inc.com>
This commit is contained in:
parent
86e0f52e17
commit
ccb2a8d747
@ -183,6 +183,10 @@ 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)
|
log.G(ctx).Debugf("Use OCI runtime %+v for sandbox %q and container %q", ociRuntime, sandboxID, id)
|
||||||
|
|
||||||
|
imageName := containerdImage.Name()
|
||||||
|
if name := config.GetImage().GetUserSpecifiedImage(); name != "" {
|
||||||
|
imageName = name
|
||||||
|
}
|
||||||
spec, err := c.buildContainerSpec(
|
spec, err := c.buildContainerSpec(
|
||||||
platform,
|
platform,
|
||||||
id,
|
id,
|
||||||
@ -190,7 +194,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
|||||||
sandboxPid,
|
sandboxPid,
|
||||||
sandbox.NetNSPath,
|
sandbox.NetNSPath,
|
||||||
containerName,
|
containerName,
|
||||||
containerdImage.Name(),
|
imageName,
|
||||||
config,
|
config,
|
||||||
sandboxConfig,
|
sandboxConfig,
|
||||||
&image.ImageSpec.Config,
|
&image.ImageSpec.Config,
|
||||||
|
Loading…
Reference in New Issue
Block a user