Merge pull request #3878 from thockin/infra_name

Use a constant for the pod infra container name
This commit is contained in:
Brian Grant
2015-01-30 09:18:00 -08:00
6 changed files with 64 additions and 36 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/leaky"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/pod"
@@ -193,7 +194,7 @@ func (p *PodCache) computePodStatus(pod *api.Pod) (api.PodStatus, error) {
} else {
newStatus.Info = result.Status.Info
newStatus.Phase = getPhase(&pod.Spec, newStatus.Info)
if netContainerInfo, ok := newStatus.Info["POD"]; ok {
if netContainerInfo, ok := newStatus.Info[leaky.PodInfraContainerName]; ok {
if netContainerInfo.PodIP != "" {
newStatus.PodIP = netContainerInfo.PodIP
}

View File

@@ -24,6 +24,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/leaky"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/registrytest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
@@ -370,7 +371,7 @@ func TestFillPodStatus(t *testing.T) {
HostIP: "ip of machine",
PodIP: expectedIP,
Info: api.PodInfo{
"POD": {
leaky.PodInfraContainerName: {
State: api.ContainerState{
Running: &api.ContainerStateRunning{
StartedAt: util.NewTime(expectedTime),
@@ -405,7 +406,7 @@ func TestFillPodInfoNoData(t *testing.T) {
Host: "machine",
HostIP: "ip of machine",
Info: api.PodInfo{
"POD": {},
leaky.PodInfraContainerName: {},
},
},
nodes: []api.Node{*makeHealthyNode("machine")},