Skip to content

Commit

Permalink
Change podStatus from Nodes.List() -> Nodes.Get(name)
Browse files Browse the repository at this point in the history
Retrieves a lot less data
  • Loading branch information
smarterclayton committed Dec 10, 2014
1 parent d1d7505 commit 0d887ae
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions pkg/registry/pod/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,26 +274,19 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
return addr.String()
}

func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodPhase, error) {
func getPodStatus(pod *api.Pod, nodes client.NodeInterface) (api.PodPhase, error) {
if pod.Status.Host == "" {
return api.PodPending, nil
}
if minions != nil {
res, err := minions.List()
if nodes != nil {
_, err := nodes.Get(pod.Status.Host)
if err != nil {
if errors.IsNotFound(err) {
return api.PodFailed, nil
}
glog.Errorf("Error listing minions: %v", err)
return "", err
}
found := false
for _, minion := range res.Items {
if minion.Name == pod.Status.Host {
found = true
break
}
}
if !found {
return api.PodFailed, nil
}
} else {
glog.Errorf("Unexpected missing minion interface, status may be in-accurate")
}
Expand Down

0 comments on commit 0d887ae

Please sign in to comment.