func (storage *PodRegistryStorage) List(query labels.Query) (interface{}, error) { var result api.PodList pods, err := storage.registry.ListPods(query) if err == nil { result.Items = pods } result.Kind = "cluster#podList" return result, err }
func (storage *PodRegistryStorage) List(url *url.URL) (interface{}, error) { var result api.PodList var query *map[string]string if url != nil { queryMap := client.DecodeLabelQuery(url.Query().Get("labels")) query = &queryMap } pods, err := storage.registry.ListPods(query) if err == nil { result = api.PodList{ Items: pods, } } result.Kind = "cluster#podList" return result, err }
func (storage *PodRegistryStorage) List(selector labels.Selector) (interface{}, error) { var result api.PodList pods, err := storage.registry.ListPods(selector) if err == nil { result.Items = pods // Get cached info for the list currently. // TODO: Optionally use fresh info if storage.podCache != nil { for ix, pod := range pods { info, err := storage.podCache.GetContainerInfo(pod.CurrentState.Host, pod.ID) if err != nil { log.Printf("Error getting container info: %#v", err) continue } result.Items[ix].CurrentState.Info = info } } } result.Kind = "cluster#podList" return result, err }