// encodePods creates an api.PodList object from pods and returns the encoded // PodList. func encodePods(pods []*api.Pod) (data []byte, err error) { podList := new(api.PodList) for _, pod := range pods { podList.Items = append(podList.Items, *pod) } return latest.GroupOrDie("").Codec.Encode(podList) }
// Please note that selector is filtering among the pods that have gotten into // the store; there may have been some filtering that already happened before // that. func (s storePodsNamespacer) List(selector labels.Selector) (pods api.PodList, err error) { list := api.PodList{} for _, m := range s.store.List() { pod := m.(*api.Pod) if s.namespace == api.NamespaceAll || s.namespace == pod.Namespace { if selector.Matches(labels.Set(pod.Labels)) { list.Items = append(list.Items, *pod) } } } return list, nil }