mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
rkt: Append tag to the returned image name.
This commit is contained in:
parent
62399077d8
commit
89feb6fc53
@ -218,7 +218,8 @@ type Container struct {
|
|||||||
// The name of the container, which should be the same as specified by
|
// The name of the container, which should be the same as specified by
|
||||||
// api.Container.
|
// api.Container.
|
||||||
Name string
|
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
|
Image string
|
||||||
// Hash of the container, used for comparison. Optional for containers
|
// Hash of the container, used for comparison. Optional for containers
|
||||||
// not managed by kubelet.
|
// not managed by kubelet.
|
||||||
@ -261,7 +262,8 @@ type ContainerStatus struct {
|
|||||||
FinishedAt time.Time
|
FinishedAt time.Time
|
||||||
// Exit code of the container.
|
// Exit code of the container.
|
||||||
ExitCode int
|
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
|
Image string
|
||||||
// ID of the image.
|
// ID of the image.
|
||||||
ImageID string
|
ImageID string
|
||||||
|
@ -85,7 +85,6 @@ const (
|
|||||||
authDir = "auth.d"
|
authDir = "auth.d"
|
||||||
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
|
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
|
||||||
|
|
||||||
defaultImageTag = "latest"
|
|
||||||
defaultRktAPIServiceAddr = "localhost:15441"
|
defaultRktAPIServiceAddr = "localhost:15441"
|
||||||
defaultNetworkName = "rkt.kubernetes.io"
|
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{
|
kubepod.Containers = append(kubepod.Containers, &kubecontainer.Container{
|
||||||
ID: buildContainerID(&containerID{rktpod.Id, app.Name}),
|
ID: buildContainerID(&containerID{rktpod.Id, app.Name}),
|
||||||
Name: app.Name,
|
Name: app.Name,
|
||||||
Image: app.Image.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,
|
Hash: containerHash,
|
||||||
Created: podCreated,
|
Created: podCreated,
|
||||||
State: appStateToContainerState(app.State),
|
State: appStateToContainerState(app.State),
|
||||||
@ -1459,9 +1459,10 @@ func populateContainerStatus(pod rktapi.Pod, app rktapi.App, runtimeApp appcsche
|
|||||||
CreatedAt: creationTime,
|
CreatedAt: creationTime,
|
||||||
StartedAt: creationTime,
|
StartedAt: creationTime,
|
||||||
ExitCode: int(app.ExitCode),
|
ExitCode: int(app.ExitCode),
|
||||||
Image: app.Image.Name,
|
// By default, the version returned by rkt API service will be "latest" if not specified.
|
||||||
ImageID: "rkt://" + app.Image.Id, // TODO(yifan): Add the prefix only in api.PodStatus.
|
Image: fmt.Sprintf("%s:%s", app.Image.Name, app.Image.Version),
|
||||||
Hash: hashNum,
|
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
|
// TODO(yifan): Note that now all apps share the same restart count, this might
|
||||||
// change once apps don't share the same lifecycle.
|
// change once apps don't share the same lifecycle.
|
||||||
// See https://github.com/appc/spec/pull/547.
|
// See https://github.com/appc/spec/pull/547.
|
||||||
|
@ -109,8 +109,9 @@ func makeRktPod(rktPodState rktapi.PodState,
|
|||||||
Name: appNames[i],
|
Name: appNames[i],
|
||||||
State: appStates[i],
|
State: appStates[i],
|
||||||
Image: &rktapi.Image{
|
Image: &rktapi.Image{
|
||||||
Id: imgIDs[i],
|
Id: imgIDs[i],
|
||||||
Name: imgNames[i],
|
Name: imgNames[i],
|
||||||
|
Version: "latest",
|
||||||
Manifest: mustMarshalImageManifest(
|
Manifest: mustMarshalImageManifest(
|
||||||
&appcschema.ImageManifest{
|
&appcschema.ImageManifest{
|
||||||
ACKind: appcschema.ImageManifestKind,
|
ACKind: appcschema.ImageManifestKind,
|
||||||
@ -372,7 +373,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
|
||||||
Name: "app-1",
|
Name: "app-1",
|
||||||
Image: "img-name-1",
|
Image: "img-name-1:latest",
|
||||||
Hash: 1001,
|
Hash: 1001,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "running",
|
State: "running",
|
||||||
@ -380,7 +381,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
|
||||||
Name: "app-2",
|
Name: "app-2",
|
||||||
Image: "img-name-2",
|
Image: "img-name-2:latest",
|
||||||
Hash: 1002,
|
Hash: 1002,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "exited",
|
State: "exited",
|
||||||
@ -432,7 +433,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-1"),
|
||||||
Name: "app-1",
|
Name: "app-1",
|
||||||
Image: "img-name-1",
|
Image: "img-name-1:latest",
|
||||||
Hash: 1001,
|
Hash: 1001,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "running",
|
State: "running",
|
||||||
@ -440,7 +441,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4002:app-2"),
|
||||||
Name: "app-2",
|
Name: "app-2",
|
||||||
Image: "img-name-2",
|
Image: "img-name-2:latest",
|
||||||
Hash: 1002,
|
Hash: 1002,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "exited",
|
State: "exited",
|
||||||
@ -455,7 +456,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-11"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-11"),
|
||||||
Name: "app-11",
|
Name: "app-11",
|
||||||
Image: "img-name-11",
|
Image: "img-name-11:latest",
|
||||||
Hash: 10011,
|
Hash: 10011,
|
||||||
Created: 90000,
|
Created: 90000,
|
||||||
State: "exited",
|
State: "exited",
|
||||||
@ -463,7 +464,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-22"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4003:app-22"),
|
||||||
Name: "app-22",
|
Name: "app-22",
|
||||||
Image: "img-name-22",
|
Image: "img-name-22:latest",
|
||||||
Hash: 10022,
|
Hash: 10022,
|
||||||
Created: 90000,
|
Created: 90000,
|
||||||
State: "exited",
|
State: "exited",
|
||||||
@ -471,7 +472,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-11"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-11"),
|
||||||
Name: "app-11",
|
Name: "app-11",
|
||||||
Image: "img-name-11",
|
Image: "img-name-11:latest",
|
||||||
Hash: 10011,
|
Hash: 10011,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "running",
|
State: "running",
|
||||||
@ -479,7 +480,7 @@ func TestGetPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-22"),
|
ID: kubecontainer.BuildContainerID("rkt", "uuid-4004:app-22"),
|
||||||
Name: "app-22",
|
Name: "app-22",
|
||||||
Image: "img-name-22",
|
Image: "img-name-22:latest",
|
||||||
Hash: 10022,
|
Hash: 10022,
|
||||||
Created: 100000,
|
Created: 100000,
|
||||||
State: "running",
|
State: "running",
|
||||||
@ -591,7 +592,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateRunning,
|
State: kubecontainer.ContainerStateRunning,
|
||||||
CreatedAt: time.Unix(100000, 0),
|
CreatedAt: time.Unix(100000, 0),
|
||||||
StartedAt: time.Unix(100000, 0),
|
StartedAt: time.Unix(100000, 0),
|
||||||
Image: "img-name-1",
|
Image: "img-name-1:latest",
|
||||||
ImageID: "rkt://img-id-1",
|
ImageID: "rkt://img-id-1",
|
||||||
Hash: 1001,
|
Hash: 1001,
|
||||||
RestartCount: 7,
|
RestartCount: 7,
|
||||||
@ -602,7 +603,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateExited,
|
State: kubecontainer.ContainerStateExited,
|
||||||
CreatedAt: time.Unix(100000, 0),
|
CreatedAt: time.Unix(100000, 0),
|
||||||
StartedAt: time.Unix(100000, 0),
|
StartedAt: time.Unix(100000, 0),
|
||||||
Image: "img-name-2",
|
Image: "img-name-2:latest",
|
||||||
ImageID: "rkt://img-id-2",
|
ImageID: "rkt://img-id-2",
|
||||||
Hash: 1002,
|
Hash: 1002,
|
||||||
RestartCount: 7,
|
RestartCount: 7,
|
||||||
@ -648,7 +649,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateRunning,
|
State: kubecontainer.ContainerStateRunning,
|
||||||
CreatedAt: time.Unix(90000, 0),
|
CreatedAt: time.Unix(90000, 0),
|
||||||
StartedAt: time.Unix(90000, 0),
|
StartedAt: time.Unix(90000, 0),
|
||||||
Image: "img-name-1",
|
Image: "img-name-1:latest",
|
||||||
ImageID: "rkt://img-id-1",
|
ImageID: "rkt://img-id-1",
|
||||||
Hash: 1001,
|
Hash: 1001,
|
||||||
RestartCount: 7,
|
RestartCount: 7,
|
||||||
@ -659,7 +660,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateExited,
|
State: kubecontainer.ContainerStateExited,
|
||||||
CreatedAt: time.Unix(90000, 0),
|
CreatedAt: time.Unix(90000, 0),
|
||||||
StartedAt: time.Unix(90000, 0),
|
StartedAt: time.Unix(90000, 0),
|
||||||
Image: "img-name-2",
|
Image: "img-name-2:latest",
|
||||||
ImageID: "rkt://img-id-2",
|
ImageID: "rkt://img-id-2",
|
||||||
Hash: 1002,
|
Hash: 1002,
|
||||||
RestartCount: 7,
|
RestartCount: 7,
|
||||||
@ -671,7 +672,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateRunning,
|
State: kubecontainer.ContainerStateRunning,
|
||||||
CreatedAt: time.Unix(100000, 0),
|
CreatedAt: time.Unix(100000, 0),
|
||||||
StartedAt: time.Unix(100000, 0),
|
StartedAt: time.Unix(100000, 0),
|
||||||
Image: "img-name-1",
|
Image: "img-name-1:latest",
|
||||||
ImageID: "rkt://img-id-1",
|
ImageID: "rkt://img-id-1",
|
||||||
Hash: 1001,
|
Hash: 1001,
|
||||||
RestartCount: 10,
|
RestartCount: 10,
|
||||||
@ -682,7 +683,7 @@ func TestGetPodStatus(t *testing.T) {
|
|||||||
State: kubecontainer.ContainerStateExited,
|
State: kubecontainer.ContainerStateExited,
|
||||||
CreatedAt: time.Unix(100000, 0),
|
CreatedAt: time.Unix(100000, 0),
|
||||||
StartedAt: time.Unix(100000, 0),
|
StartedAt: time.Unix(100000, 0),
|
||||||
Image: "img-name-2",
|
Image: "img-name-2:latest",
|
||||||
ImageID: "rkt://img-id-2",
|
ImageID: "rkt://img-id-2",
|
||||||
Hash: 1002,
|
Hash: 1002,
|
||||||
RestartCount: 10,
|
RestartCount: 10,
|
||||||
|
Loading…
Reference in New Issue
Block a user