From ed2caf17e05149a177ddcff768b704b3aa0885b1 Mon Sep 17 00:00:00 2001 From: SataQiu Date: Mon, 27 Feb 2023 16:02:59 +0800 Subject: [PATCH] kubelet: remove unused DockerID type --- pkg/kubelet/container/runtime.go | 11 ----------- pkg/kubelet/kuberuntime/legacy_test.go | 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/pkg/kubelet/container/runtime.go b/pkg/kubelet/container/runtime.go index e53b74bca54..dae734ac4fd 100644 --- a/pkg/kubelet/container/runtime.go +++ b/pkg/kubelet/container/runtime.go @@ -253,17 +253,6 @@ func (c *ContainerID) UnmarshalJSON(data []byte) error { return c.ParseString(string(data)) } -// DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids -type DockerID string - -// ContainerID converts DockerID into a ContainerID. -func (id DockerID) ContainerID() ContainerID { - return ContainerID{ - Type: "docker", - ID: string(id), - } -} - // State represents the state of a container type State string diff --git a/pkg/kubelet/kuberuntime/legacy_test.go b/pkg/kubelet/kuberuntime/legacy_test.go index 7d99032fd3d..61cf9d92461 100644 --- a/pkg/kubelet/kuberuntime/legacy_test.go +++ b/pkg/kubelet/kuberuntime/legacy_test.go @@ -40,10 +40,10 @@ func TestLogSymLink(t *testing.T) { containerLogsDir := "/foo/bar" podFullName := randStringBytes(128) containerName := randStringBytes(70) - dockerID := randStringBytes(80) + containerID := randStringBytes(80) // The file name cannot exceed 255 characters. Since .log suffix is required, the prefix cannot exceed 251 characters. - expectedPath := filepath.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, dockerID)[:251]+".log") - as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, dockerID)) + expectedPath := filepath.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, containerID)[:251]+".log") + as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, containerID)) } func TestLegacyLogSymLink(t *testing.T) {