mirror of https://github.com/k3s-io/k3s
Change podStatus from Nodes.List() -> Nodes.Get(name)
Retrieves a lot less datapull/6/head
parent
d1d7505272
commit
0d887ae7b3
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue