mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #24630 from euank/redundant-created
Automatic merge from submit-queue kubelet: Remove redundant `Container.Created` As far as I can tell, this has been supplanted by a) the `DockerJSON.CreatedAt` field and b) the `ContainerStatus.CreatedAt`, where the first is used for creating the second. The `.Created` field was only written to as far as I can see. cc @yifan-gu & @Random-Liu Is there any reason we might want to keep this around?
This commit is contained in:
commit
fe135fc251
@ -95,7 +95,6 @@ func ConvertPodStatusToRunningPod(podStatus *PodStatus) Pod {
|
||||
Name: containerStatus.Name,
|
||||
Image: containerStatus.Image,
|
||||
Hash: containerStatus.Hash,
|
||||
Created: containerStatus.CreatedAt.Unix(),
|
||||
State: containerStatus.State,
|
||||
}
|
||||
runningPod.Containers = append(runningPod.Containers, container)
|
||||
|
@ -237,9 +237,6 @@ type Container struct {
|
||||
// Hash of the container, used for comparison. Optional for containers
|
||||
// not managed by kubelet.
|
||||
Hash uint64
|
||||
// The timestamp of the creation time of the container.
|
||||
// TODO(yifan): Consider to move it to api.ContainerStatus.
|
||||
Created int64
|
||||
// State is the state of the container.
|
||||
State ContainerState
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ func toRuntimeContainer(c *dockertypes.Container) (*kubecontainer.Container, err
|
||||
Name: dockerName.ContainerName,
|
||||
Image: c.Image,
|
||||
Hash: hash,
|
||||
Created: c.Created,
|
||||
// (random-liu) docker uses status to indicate whether a container is running or exited.
|
||||
// However, in kubernetes we usually use state to indicate whether a container is running or exited,
|
||||
// while use status to indicate the comprehensive status of the container. So we have different naming
|
||||
|
@ -46,7 +46,6 @@ func TestToRuntimeContainer(t *testing.T) {
|
||||
original := &dockertypes.Container{
|
||||
ID: "ab2cdf",
|
||||
Image: "bar_image",
|
||||
Created: 12345,
|
||||
Names: []string{"/k8s_bar.5678_foo_ns_1234_42"},
|
||||
Status: "Up 5 hours",
|
||||
}
|
||||
@ -55,7 +54,6 @@ func TestToRuntimeContainer(t *testing.T) {
|
||||
Name: "bar",
|
||||
Image: "bar_image",
|
||||
Hash: 0x5678,
|
||||
Created: 12345,
|
||||
State: kubecontainer.ContainerStateRunning,
|
||||
}
|
||||
|
||||
|
@ -816,7 +816,6 @@ func apiPodToruntimePod(uuid string, pod *api.Pod) *kubecontainer.Pod {
|
||||
Name: c.Name,
|
||||
Image: c.Image,
|
||||
Hash: kubecontainer.HashContainer(c),
|
||||
Created: time.Now().Unix(),
|
||||
})
|
||||
}
|
||||
return p
|
||||
@ -1196,7 +1195,6 @@ func (r *Runtime) convertRktPod(rktpod *rktapi.Pod) (*kubecontainer.Pod, error)
|
||||
Image: fmt.Sprintf("%s:%s", app.Image.Name, app.Image.Version),
|
||||
Hash: containerHash,
|
||||
State: appStateToContainerState(app.State),
|
||||
Created: time.Unix(0, rktpod.CreatedAt).Unix(), // convert ns to s
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-1",
|
||||
Image: "img-name-1:latest",
|
||||
Hash: 1001,
|
||||
Created: 10,
|
||||
State: "running",
|
||||
},
|
||||
{
|
||||
@ -391,7 +390,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-2",
|
||||
Image: "img-name-2:latest",
|
||||
Hash: 1002,
|
||||
Created: 10,
|
||||
State: "exited",
|
||||
},
|
||||
},
|
||||
@ -443,7 +441,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-1",
|
||||
Image: "img-name-1:latest",
|
||||
Hash: 1001,
|
||||
Created: 10,
|
||||
State: "running",
|
||||
},
|
||||
{
|
||||
@ -451,7 +448,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-2",
|
||||
Image: "img-name-2:latest",
|
||||
Hash: 1002,
|
||||
Created: 10,
|
||||
State: "exited",
|
||||
},
|
||||
},
|
||||
@ -466,7 +462,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-11",
|
||||
Image: "img-name-11:latest",
|
||||
Hash: 10011,
|
||||
Created: 30,
|
||||
State: "exited",
|
||||
},
|
||||
{
|
||||
@ -474,7 +469,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-22",
|
||||
Image: "img-name-22:latest",
|
||||
Hash: 10022,
|
||||
Created: 30,
|
||||
State: "exited",
|
||||
},
|
||||
{
|
||||
@ -482,7 +476,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-11",
|
||||
Image: "img-name-11:latest",
|
||||
Hash: 10011,
|
||||
Created: 50,
|
||||
State: "running",
|
||||
},
|
||||
{
|
||||
@ -490,7 +483,6 @@ func TestGetPods(t *testing.T) {
|
||||
Name: "app-22",
|
||||
Image: "img-name-22:latest",
|
||||
Hash: 10022,
|
||||
Created: 50,
|
||||
State: "running",
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user