Exemplo n.º 1
0
// GetPodStatus currently invokes GetPods() to return the status.
// TODO(yifan): Split the get status logic from GetPods().
func (r *runtime) GetPodStatus(pod *api.Pod) (*api.PodStatus, error) {
	pods, err := r.GetPods(true)
	if err != nil {
		return nil, err
	}
	p := qingcontainer.Pods(pods).FindPodByID(pod.UID)
	if len(p.Containers) == 0 {
		return nil, fmt.Errorf("cannot find status for pod: %q", qingcontainer.BuildPodFullName(pod.Name, pod.Namespace))
	}
	return &p.Status, nil
}
Exemplo n.º 2
0
// GetPodByName provides the (non-mirror) pod that matches namespace and name,
// as well as whether the pod was found.
func (pm *basicPodManager) GetPodByName(namespace, name string) (*api.Pod, bool) {
	podFullName := qingcontainer.BuildPodFullName(name, namespace)
	return pm.GetPodByFullName(podFullName)
}