diff --git a/pkg/registry/etcd_registry.go b/pkg/registry/etcd_registry.go index 55dfeb61b41..fcf5ee064c6 100644 --- a/pkg/registry/etcd_registry.go +++ b/pkg/registry/etcd_registry.go @@ -78,6 +78,7 @@ func (registry *EtcdRegistry) ListPods(query labels.Query) ([]api.Pod, error) { } for _, pod := range machinePods { if query.Matches(labels.Set(pod.Labels)) { + pod.CurrentState.Host = machine pods = append(pods, pod) } } diff --git a/pkg/registry/etcd_registry_test.go b/pkg/registry/etcd_registry_test.go index a9872b888fd..4e13dc9ab12 100644 --- a/pkg/registry/etcd_registry_test.go +++ b/pkg/registry/etcd_registry_test.go @@ -354,6 +354,10 @@ func TestEtcdListPods(t *testing.T) { if len(pods) != 2 || pods[0].ID != "foo" || pods[1].ID != "bar" { t.Errorf("Unexpected pod list: %#v", pods) } + if pods[0].CurrentState.Host != "machine" || + pods[1].CurrentState.Host != "machine" { + t.Errorf("Failed to populate host name.") + } } func TestEtcdListControllersNotFound(t *testing.T) {