Kubelet: refactor pod manager

This change cleans up the pod manager extensively so that
 * Mirror pods are actually stored in the pod manager.
 * Both (non-mirror) pods and mirror pods are indexed by UID and full name for
   easy lookup and mapping. This is required for the next change to send
   full pod along with the pod status update.

This change also renames mirrorManager as mirrorClient since it is merely a
client to contact the API server and create/delete mirror pods.
This commit is contained in:
Yu-Ju Hong
2015-03-23 12:17:12 -07:00
parent ed68c8e82b
commit 08e4a883b6
9 changed files with 374 additions and 375 deletions

View File

@@ -82,7 +82,7 @@ type HostInterface interface {
GetRootInfo(req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)
GetDockerVersion() ([]uint, error)
GetCachedMachineInfo() (*cadvisorApi.MachineInfo, error)
GetPods() ([]api.Pod, mirrorPods)
GetPods() []api.Pod
GetPodByName(namespace, name string) (*api.Pod, bool)
GetPodStatus(name string) (api.PodStatus, error)
RunInContainer(name string, uid types.UID, container string, cmd []string) ([]byte, error)
@@ -260,7 +260,7 @@ func (s *Server) handleContainerLogs(w http.ResponseWriter, req *http.Request) {
// handlePods returns a list of pod bound to the Kubelet and their spec
func (s *Server) handlePods(w http.ResponseWriter, req *http.Request) {
pods, _ := s.host.GetPods()
pods := s.host.GetPods()
podList := &api.PodList{
Items: pods,
}