Commit e01df695 authored by Federico Simoncelli's avatar Federico Simoncelli

api: add image's id to ContainerStatus

Sometimes for external applications it is important to identify exactly what images are running. Since tags can be moved to point to newer builds this information can be used to identify old images running. Signed-off-by: 's avatarFederico Simoncelli <fsimonce@redhat.com>
parent c1ca0733
...@@ -440,6 +440,7 @@ type ContainerStatus struct { ...@@ -440,6 +440,7 @@ type ContainerStatus struct {
PodIP string `json:"podIP,omitempty"` PodIP string `json:"podIP,omitempty"`
// TODO(dchen1107): Need to decide how to represent this in v1beta3 // TODO(dchen1107): Need to decide how to represent this in v1beta3
Image string `json:"image"` Image string `json:"image"`
ImageID string `json:"imageID" description:"ID of the container's image"`
ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"` ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"`
} }
......
...@@ -406,6 +406,7 @@ type ContainerStatus struct { ...@@ -406,6 +406,7 @@ type ContainerStatus struct {
PodIP string `json:"podIP,omitempty" description:"pod's IP address"` PodIP string `json:"podIP,omitempty" description:"pod's IP address"`
// TODO(dchen1107): Need to decide how to reprensent this in v1beta3 // TODO(dchen1107): Need to decide how to reprensent this in v1beta3
Image string `json:"image" description:"image of the container"` Image string `json:"image" description:"image of the container"`
ImageID string `json:"imageID" description:"ID of the container's image"`
ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"` ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"`
} }
......
...@@ -370,6 +370,7 @@ type ContainerStatus struct { ...@@ -370,6 +370,7 @@ type ContainerStatus struct {
PodIP string `json:"podIP,omitempty" description:"pod's IP address"` PodIP string `json:"podIP,omitempty" description:"pod's IP address"`
// TODO(dchen1107): Need to decide how to reprensent this in v1beta3 // TODO(dchen1107): Need to decide how to reprensent this in v1beta3
Image string `json:"image" description:"image of the container"` Image string `json:"image" description:"image of the container"`
ImageID string `json:"imageID" description:"ID of the container's image"`
ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"` ContainerID string `json:"containerID,omitempty" description:"container's ID in the format 'docker://<container_id>'"`
} }
......
...@@ -462,7 +462,8 @@ type ContainerStatus struct { ...@@ -462,7 +462,8 @@ type ContainerStatus struct {
PodIP string `json:"podIP,omitempty"` PodIP string `json:"podIP,omitempty"`
// TODO(dchen1107): Which image the container is running with? // TODO(dchen1107): Which image the container is running with?
// The image the container is running // The image the container is running
Image string `json:"image"` Image string `json:"image"`
ImageID string `json:"imageID" description:"ID of the container's image"`
} }
// PodInfo contains one entry for every container with available info. // PodInfo contains one entry for every container with available info.
......
...@@ -41,6 +41,7 @@ import ( ...@@ -41,6 +41,7 @@ import (
const ( const (
PodInfraContainerName = leaky.PodInfraContainerName PodInfraContainerName = leaky.PodInfraContainerName
DockerPrefix = "docker://"
) )
// DockerInterface is an abstract interface for testability. It abstracts the interface of docker.Client. // DockerInterface is an abstract interface for testability. It abstracts the interface of docker.Client.
...@@ -399,7 +400,8 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str ...@@ -399,7 +400,8 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str
glog.V(3).Infof("Container inspect result: %+v", *inspectResult) glog.V(3).Infof("Container inspect result: %+v", *inspectResult)
containerStatus := api.ContainerStatus{ containerStatus := api.ContainerStatus{
Image: inspectResult.Config.Image, Image: inspectResult.Config.Image,
ContainerID: "docker://" + dockerID, ImageID: DockerPrefix + inspectResult.Image,
ContainerID: DockerPrefix + dockerID,
} }
waiting := true waiting := true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment