Merge pull request #23205 from yifan-gu/append_image_tag

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-03-22 07:30:52 -07:00
commit 566d23e880
3 changed files with 29 additions and 25 deletions

View File

@ -218,7 +218,8 @@ type Container struct {
// The name of the container, which should be the same as specified by
// api.Container.
Name string
// The image name of the container.
// The image name of the container, this also includes the tag of the image,
// the expected form is "NAME:TAG".
Image string
// Hash of the container, used for comparison. Optional for containers
// not managed by kubelet.
@ -261,7 +262,8 @@ type ContainerStatus struct {
FinishedAt time.Time
// Exit code of the container.
ExitCode int
// Name of the image.
// Name of the image, this also includes the tag of the image,
// the expected form is "NAME:TAG".
Image string
// ID of the image.
ImageID string

View File

@ -85,7 +85,6 @@ const (
authDir = "auth.d"
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
defaultImageTag = "latest"
defaultRktAPIServiceAddr = "localhost:15441"
defaultNetworkName = "rkt.kubernetes.io"
@ -982,9 +981,10 @@ func (r *Runtime) convertRktPod(rktpod *rktapi.Pod) (*kubecontainer.Pod, error)
}
kubepod.Containers = append(kubepod.Containers, &kubecontainer.Container{
ID: buildContainerID(&containerID{rktpod.Id, app.Name}),
Name: app.Name,
Image: app.Image.Name,
ID: buildContainerID(&containerID{rktpod.Id, app.Name}),
Name: app.Name,
// By default, the version returned by rkt API service will be "latest" if not specified.
Image: fmt.Sprintf("%s:%s", app.Image.Name, app.Image.Version),
Hash: containerHash,
Created: podCreated,
State: appStateToContainerState(app.State),
@ -1459,9 +1459,10 @@ func populateContainerStatus(pod rktapi.Pod, app rktapi.App, runtimeApp appcsche
CreatedAt: creationTime,
StartedAt: creationTime,
ExitCode: int(app.ExitCode),
Image: app.Image.Name,
ImageID: "rkt://" + app.Image.Id, // TODO(yifan): Add the prefix only in api.PodStatus.
Hash: hashNum,
// By default, the version returned by rkt API service will be "latest" if not specified.
Image: fmt.Sprintf("%s:%s", app.Image.Name, app.Image.Version),
ImageID: "rkt://" + app.Image.Id, // TODO(yifan): Add the prefix only in api.PodStatus.
Hash: hashNum,
// TODO(yifan): Note that now all apps share the same restart count, this might
// change once apps don't share the same lifecycle.
// See https://github.com/appc/spec/pull/547.

View File

@ -109,8 +109,9 @@ func makeRktPod(rktPodState rktapi.PodState,
Name: appNames[i],
State: appStates[i],
Image: &rktapi.Image{
Id: imgIDs[i],
Name: imgNames[i],
Id: imgIDs[i],
Name: imgNames[i],
Version: "latest",
Manifest: mustMarshalImageManifest(
&appcschema.ImageManifest{
ACKind: appcschema.ImageManifestKind,
@ -372,7 +373,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
Name: "app-1",
Image: "img-name-1",
Image: "img-name-1:latest",
Hash: 1001,
Created: 100000,
State: "running",
@ -380,7 +381,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
Name: "app-2",
Image: "img-name-2",
Image: "img-name-2:latest",
Hash: 1002,
Created: 100000,
State: "exited",
@ -432,7 +433,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
Name: "app-1",
Image: "img-name-1",
Image: "img-name-1:latest",
Hash: 1001,
Created: 100000,
State: "running",
@ -440,7 +441,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
Name: "app-2",
Image: "img-name-2",
Image: "img-name-2:latest",
Hash: 1002,
Created: 100000,
State: "exited",
@ -455,7 +456,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-11"),
Name: "app-11",
Image: "img-name-11",
Image: "img-name-11:latest",
Hash: 10011,
Created: 90000,
State: "exited",
@ -463,7 +464,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-22"),
Name: "app-22",
Image: "img-name-22",
Image: "img-name-22:latest",
Hash: 10022,
Created: 90000,
State: "exited",
@ -471,7 +472,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-11"),
Name: "app-11",
Image: "img-name-11",
Image: "img-name-11:latest",
Hash: 10011,
Created: 100000,
State: "running",
@ -479,7 +480,7 @@ func TestGetPods(t *testing.T) {
{
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-22"),
Name: "app-22",
Image: "img-name-22",
Image: "img-name-22:latest",
Hash: 10022,
Created: 100000,
State: "running",
@ -591,7 +592,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateRunning,
CreatedAt: time.Unix(100000, 0),
StartedAt: time.Unix(100000, 0),
Image: "img-name-1",
Image: "img-name-1:latest",
ImageID: "rkt://img-id-1",
Hash: 1001,
RestartCount: 7,
@ -602,7 +603,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateExited,
CreatedAt: time.Unix(100000, 0),
StartedAt: time.Unix(100000, 0),
Image: "img-name-2",
Image: "img-name-2:latest",
ImageID: "rkt://img-id-2",
Hash: 1002,
RestartCount: 7,
@ -648,7 +649,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateRunning,
CreatedAt: time.Unix(90000, 0),
StartedAt: time.Unix(90000, 0),
Image: "img-name-1",
Image: "img-name-1:latest",
ImageID: "rkt://img-id-1",
Hash: 1001,
RestartCount: 7,
@ -659,7 +660,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateExited,
CreatedAt: time.Unix(90000, 0),
StartedAt: time.Unix(90000, 0),
Image: "img-name-2",
Image: "img-name-2:latest",
ImageID: "rkt://img-id-2",
Hash: 1002,
RestartCount: 7,
@ -671,7 +672,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateRunning,
CreatedAt: time.Unix(100000, 0),
StartedAt: time.Unix(100000, 0),
Image: "img-name-1",
Image: "img-name-1:latest",
ImageID: "rkt://img-id-1",
Hash: 1001,
RestartCount: 10,
@ -682,7 +683,7 @@ func TestGetPodStatus(t *testing.T) {
State: kubecontainer.ContainerStateExited,
CreatedAt: time.Unix(100000, 0),
StartedAt: time.Unix(100000, 0),
Image: "img-name-2",
Image: "img-name-2:latest",
ImageID: "rkt://img-id-2",
Hash: 1002,
RestartCount: 10,