IP: Shared IPC.
This commit is contained in:
@@ -336,8 +336,8 @@ func TestSyncPodsDoesNothing(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_0"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_0"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -426,7 +426,7 @@ func matchString(t *testing.T, pattern, str string) bool {
|
||||
|
||||
func TestSyncPodsCreatesNetAndContainer(t *testing.T) {
|
||||
kubelet, fakeDocker := newTestKubelet(t)
|
||||
kubelet.networkContainerImage = "custom_image_name"
|
||||
kubelet.podInfraContainerImage = "custom_image_name"
|
||||
fakeDocker.ContainerList = []docker.APIContainers{}
|
||||
err := kubelet.SyncPods([]api.BoundPod{
|
||||
{
|
||||
@@ -455,7 +455,7 @@ func TestSyncPodsCreatesNetAndContainer(t *testing.T) {
|
||||
|
||||
found := false
|
||||
for _, c := range fakeDocker.ContainerList {
|
||||
if c.Image == "custom_image_name" && strings.HasPrefix(c.Names[0], "/k8s_net") {
|
||||
if c.Image == "custom_image_name" && strings.HasPrefix(c.Names[0], "/k8s_POD") {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,7 @@ func TestSyncPodsCreatesNetAndContainer(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(fakeDocker.Created) != 2 ||
|
||||
!matchString(t, "k8s_net\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[0]) ||
|
||||
!matchString(t, "k8s_POD\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[0]) ||
|
||||
!matchString(t, "k8s_bar\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[1]) {
|
||||
t.Errorf("Unexpected containers created %v", fakeDocker.Created)
|
||||
}
|
||||
@@ -475,7 +475,7 @@ func TestSyncPodsCreatesNetAndContainerPullsImage(t *testing.T) {
|
||||
kubelet, fakeDocker := newTestKubelet(t)
|
||||
puller := kubelet.dockerPuller.(*dockertools.FakeDockerPuller)
|
||||
puller.HasImages = []string{}
|
||||
kubelet.networkContainerImage = "custom_image_name"
|
||||
kubelet.podInfraContainerImage = "custom_image_name"
|
||||
fakeDocker.ContainerList = []docker.APIContainers{}
|
||||
err := kubelet.SyncPods([]api.BoundPod{
|
||||
{
|
||||
@@ -507,7 +507,7 @@ func TestSyncPodsCreatesNetAndContainerPullsImage(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(fakeDocker.Created) != 2 ||
|
||||
!matchString(t, "k8s_net\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[0]) ||
|
||||
!matchString(t, "k8s_POD\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[0]) ||
|
||||
!matchString(t, "k8s_bar\\.[a-f0-9]+_foo.new.test_", fakeDocker.Created[1]) {
|
||||
t.Errorf("Unexpected containers created %v", fakeDocker.Created)
|
||||
}
|
||||
@@ -518,8 +518,8 @@ func TestSyncPodsWithNetCreatesContainer(t *testing.T) {
|
||||
kubelet, fakeDocker := newTestKubelet(t)
|
||||
fakeDocker.ContainerList = []docker.APIContainers{
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_0"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_0"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -560,8 +560,8 @@ func TestSyncPodsWithNetCreatesContainerCallsHandler(t *testing.T) {
|
||||
kubelet.httpClient = &fakeHttp
|
||||
fakeDocker.ContainerList = []docker.APIContainers{
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_0"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_0"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -666,8 +666,8 @@ func TestSyncPodsDeletesWhenSourcesAreReady(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -714,8 +714,8 @@ func TestSyncPodsDeletesWhenContainerSourceReady(t *testing.T) {
|
||||
ID: "7492",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_boo.default.testSource_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_boo.default.testSource_12345678_42"},
|
||||
ID: "3542",
|
||||
},
|
||||
|
||||
@@ -725,8 +725,8 @@ func TestSyncPodsDeletesWhenContainerSourceReady(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.otherSource_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.otherSource_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -767,8 +767,8 @@ func TestSyncPodsDeletes(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
{
|
||||
@@ -805,8 +805,8 @@ func TestSyncPodDeletesDuplicate(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
"9876": &docker.APIContainers{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_bar.new.test_12345678_2222"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_bar.new.test_12345678_2222"},
|
||||
ID: "9876",
|
||||
},
|
||||
"4567": &docker.APIContainers{
|
||||
@@ -865,8 +865,8 @@ func TestSyncPodBadHash(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
"9876": &docker.APIContainers{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -912,8 +912,8 @@ func TestSyncPodUnhealthy(t *testing.T) {
|
||||
ID: "1234",
|
||||
},
|
||||
"9876": &docker.APIContainers{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -1559,8 +1559,8 @@ func TestSyncPodEventHandlerFails(t *testing.T) {
|
||||
}
|
||||
dockerContainers := dockertools.DockerContainers{
|
||||
"9876": &docker.APIContainers{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_12345678_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_12345678_42"},
|
||||
ID: "9876",
|
||||
},
|
||||
}
|
||||
@@ -1607,33 +1607,33 @@ func TestKubeletGarbageCollection(t *testing.T) {
|
||||
{
|
||||
containers: []docker.APIContainers{
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "1876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "2876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "3876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "4876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "5876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "6876",
|
||||
},
|
||||
},
|
||||
@@ -1651,38 +1651,38 @@ func TestKubeletGarbageCollection(t *testing.T) {
|
||||
{
|
||||
containers: []docker.APIContainers{
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "1876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "2876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "3876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "4876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "5876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "6876",
|
||||
},
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "7876",
|
||||
},
|
||||
},
|
||||
@@ -1707,8 +1707,8 @@ func TestKubeletGarbageCollection(t *testing.T) {
|
||||
{
|
||||
containers: []docker.APIContainers{
|
||||
{
|
||||
// network container
|
||||
Names: []string{"/k8s_net_foo.new.test_.deadbeef_42"},
|
||||
// pod infra container
|
||||
Names: []string{"/k8s_POD_foo.new.test_.deadbeef_42"},
|
||||
ID: "1876",
|
||||
},
|
||||
},
|
||||
@@ -1896,7 +1896,7 @@ func TestSyncPodsWithPullPolicy(t *testing.T) {
|
||||
kubelet, fakeDocker := newTestKubelet(t)
|
||||
puller := kubelet.dockerPuller.(*dockertools.FakeDockerPuller)
|
||||
puller.HasImages = []string{"existing_one", "want:latest"}
|
||||
kubelet.networkContainerImage = "custom_image_name"
|
||||
kubelet.podInfraContainerImage = "custom_image_name"
|
||||
fakeDocker.ContainerList = []docker.APIContainers{}
|
||||
err := kubelet.SyncPods([]api.BoundPod{
|
||||
{
|
||||
|
Reference in New Issue
Block a user