mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Use strong type for container ID
Change all references to the container ID in pkg/kubelet/... to the strong type defined in pkg/kubelet/container: ContainerID The motivation for this change is to make the format of the ID unambiguous, specifically whether or not it includes the runtime prefix (e.g. "docker://").
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/client/record"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
|
||||
"k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
)
|
||||
|
||||
var zero time.Time
|
||||
@@ -74,7 +73,7 @@ func makeImage(id int, size int64) container.Image {
|
||||
// Make a container with the specified ID. It will use the image with the same ID.
|
||||
func makeContainer(id int) *container.Container {
|
||||
return &container.Container{
|
||||
ID: types.UID(fmt.Sprintf("container-%d", id)),
|
||||
ID: container.ContainerID{"test", fmt.Sprintf("container-%d", id)},
|
||||
Image: imageName(id),
|
||||
}
|
||||
}
|
||||
@@ -322,7 +321,7 @@ func TestFreeSpaceImagesAlsoDoesLookupByRepoTags(t *testing.T) {
|
||||
{
|
||||
Containers: []*container.Container{
|
||||
{
|
||||
ID: "c5678",
|
||||
ID: container.ContainerID{"test", "c5678"},
|
||||
Image: "salad",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user