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:
Tim St. Clair
2015-10-07 10:58:05 -07:00
parent 092dddd12c
commit 551eff63b8
27 changed files with 228 additions and 211 deletions

View File

@@ -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",
},
},