diff --git a/pkg/registry/pod/rest.go b/pkg/registry/pod/rest.go index 1d74c810dc1..a80f61f9a8b 100644 --- a/pkg/registry/pod/rest.go +++ b/pkg/registry/pod/rest.go @@ -224,7 +224,7 @@ func getInstanceIP(cloud cloudprovider.Interface, host string) string { } func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus, error) { - if pod.CurrentState.Info == nil || pod.CurrentState.Host == "" { + if pod.CurrentState.Host == "" { return api.PodWaiting, nil } res, err := minions.ListMinions() @@ -242,6 +242,9 @@ func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus, if !found { return api.PodTerminated, nil } + if pod.CurrentState.Info == nil { + return api.PodWaiting, nil + } running := 0 stopped := 0 unknown := 0 diff --git a/pkg/registry/pod/rest_test.go b/pkg/registry/pod/rest_test.go index 43a3cf89281..6e9ea68c15f 100644 --- a/pkg/registry/pod/rest_test.go +++ b/pkg/registry/pod/rest_test.go @@ -377,6 +377,16 @@ func TestMakePodStatus(t *testing.T) { test string }{ {&api.Pod{DesiredState: desiredState, CurrentState: currentState}, api.PodWaiting, "waiting"}, + { + &api.Pod{ + DesiredState: desiredState, + CurrentState: api.PodState{ + Host: "machine-2", + }, + }, + api.PodTerminated, + "no info, but bad machine", + }, { &api.Pod{ DesiredState: desiredState,