Store imageName and imageRef for containers
We calculate these values at container creation time and store them in the container object as they are requested during container status. This avoids re-calculation and speeds up container status. Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
1cf5f8ee3b
commit
bfcebcdb00
6 changed files with 74 additions and 41 deletions
|
@ -350,7 +350,7 @@ func (c *ContainerServer) LoadSandbox(id string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
scontainer, err := oci.NewContainer(m.Annotations[annotations.ContainerID], cname, sandboxPath, m.Annotations[annotations.LogPath], sb.NetNs(), labels, kubeAnnotations, "", nil, id, false, false, false, privileged, trusted, sandboxDir, created, m.Annotations["org.opencontainers.image.stopSignal"])
|
||||
scontainer, err := oci.NewContainer(m.Annotations[annotations.ContainerID], cname, sandboxPath, m.Annotations[annotations.LogPath], sb.NetNs(), labels, kubeAnnotations, "", "", "", nil, id, false, false, false, privileged, trusted, sandboxDir, created, m.Annotations["org.opencontainers.image.stopSignal"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -440,6 +440,16 @@ func (c *ContainerServer) LoadContainer(id string) error {
|
|||
img = ""
|
||||
}
|
||||
|
||||
imgName, ok := m.Annotations[annotations.ImageName]
|
||||
if !ok {
|
||||
imgName = ""
|
||||
}
|
||||
|
||||
imgRef, ok := m.Annotations[annotations.ImageRef]
|
||||
if !ok {
|
||||
imgRef = ""
|
||||
}
|
||||
|
||||
kubeAnnotations := make(map[string]string)
|
||||
if err = json.Unmarshal([]byte(m.Annotations[annotations.Annotations]), &kubeAnnotations); err != nil {
|
||||
return err
|
||||
|
@ -450,7 +460,7 @@ func (c *ContainerServer) LoadContainer(id string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
ctr, err := oci.NewContainer(id, name, containerPath, m.Annotations[annotations.LogPath], sb.NetNs(), labels, kubeAnnotations, img, &metadata, sb.ID(), tty, stdin, stdinOnce, sb.Privileged(), sb.Trusted(), containerDir, created, m.Annotations["org.opencontainers.image.stopSignal"])
|
||||
ctr, err := oci.NewContainer(id, name, containerPath, m.Annotations[annotations.LogPath], sb.NetNs(), labels, kubeAnnotations, img, imgName, imgRef, &metadata, sb.ID(), tty, stdin, stdinOnce, sb.Privileged(), sb.Trusted(), containerDir, created, m.Annotations["org.opencontainers.image.stopSignal"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue