Change podStatus from Nodes.List() -> Nodes.Get(name)

Retrieves a lot less data
pull/6/head
Clayton Coleman 2014-12-08 01:01:20 -05:00
parent d1d7505272
commit 0d887ae7b3
1 changed files with 6 additions and 13 deletions

View File

@ -274,26 +274,19 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
return addr.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 == "" { if pod.Status.Host == "" {
return api.PodPending, nil return api.PodPending, nil
} }
if minions != nil { if nodes != nil {
res, err := minions.List() _, err := nodes.Get(pod.Status.Host)
if err != nil { if err != nil {
if errors.IsNotFound(err) {
return api.PodFailed, nil
}
glog.Errorf("Error listing minions: %v", err) glog.Errorf("Error listing minions: %v", err)
return "", 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 { } else {
glog.Errorf("Unexpected missing minion interface, status may be in-accurate") glog.Errorf("Unexpected missing minion interface, status may be in-accurate")
} }