mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #4970 from dchen1107/podstatus
Hide POD container from end users
This commit is contained in:
		@@ -91,7 +91,6 @@ func (fakeKubeletClient) GetPodStatus(host, podNamespace, podID string) (api.Pod
 | 
				
			|||||||
	m := make(api.PodInfo)
 | 
						m := make(api.PodInfo)
 | 
				
			||||||
	for k, v := range r.Status.Info {
 | 
						for k, v := range r.Status.Info {
 | 
				
			||||||
		v.Ready = true
 | 
							v.Ready = true
 | 
				
			||||||
		v.PodIP = "1.2.3.4"
 | 
					 | 
				
			||||||
		m[k] = v
 | 
							m[k] = v
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	r.Status.Info = m
 | 
						r.Status.Info = m
 | 
				
			||||||
@@ -258,8 +257,10 @@ func endpointsSet(c *client.Client, serviceNamespace, serviceID string, endpoint
 | 
				
			|||||||
	return func() (bool, error) {
 | 
						return func() (bool, error) {
 | 
				
			||||||
		endpoints, err := c.Endpoints(serviceNamespace).Get(serviceID)
 | 
							endpoints, err := c.Endpoints(serviceNamespace).Get(serviceID)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
 | 
								glog.Infof("Error on creating endpoints: %v", err)
 | 
				
			||||||
			return false, nil
 | 
								return false, nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							glog.Infof("endpoints: %v", endpoints.Endpoints)
 | 
				
			||||||
		return len(endpoints.Endpoints) == endpointCount, nil
 | 
							return len(endpoints.Endpoints) == endpointCount, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -590,7 +590,8 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str
 | 
				
			|||||||
	return &containerStatus, nil
 | 
						return &containerStatus, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetDockerPodInfo returns docker info for all containers in the pod/manifest.
 | 
					// GetDockerPodInfo returns docker info for all containers in the pod/manifest and
 | 
				
			||||||
 | 
					// infrastructure container
 | 
				
			||||||
func GetDockerPodInfo(client DockerInterface, manifest api.PodSpec, podFullName string, uid types.UID) (api.PodInfo, error) {
 | 
					func GetDockerPodInfo(client DockerInterface, manifest api.PodSpec, podFullName string, uid types.UID) (api.PodInfo, error) {
 | 
				
			||||||
	info := api.PodInfo{}
 | 
						info := api.PodInfo{}
 | 
				
			||||||
	expectedContainers := make(map[string]api.Container)
 | 
						expectedContainers := make(map[string]api.Container)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1722,21 +1722,19 @@ func (kl *Kubelet) GetPodStatus(podFullName string, uid types.UID) (api.PodStatu
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Assume info is ready to process
 | 
						// Assume info is ready to process
 | 
				
			||||||
	podStatus.Phase = getPhase(spec, info)
 | 
						podStatus.Phase = getPhase(spec, info)
 | 
				
			||||||
 | 
						podStatus.Info = api.PodInfo{}
 | 
				
			||||||
	for _, c := range spec.Containers {
 | 
						for _, c := range spec.Containers {
 | 
				
			||||||
		containerStatus := info[c.Name]
 | 
							containerStatus := info[c.Name]
 | 
				
			||||||
		containerStatus.Ready = kl.readiness.IsReady(containerStatus)
 | 
							containerStatus.Ready = kl.readiness.IsReady(containerStatus)
 | 
				
			||||||
		info[c.Name] = containerStatus
 | 
							podStatus.Info[c.Name] = containerStatus
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	podStatus.Conditions = append(podStatus.Conditions, getPodReadyCondition(spec, info)...)
 | 
						podStatus.Conditions = append(podStatus.Conditions, getPodReadyCondition(spec, podStatus.Info)...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	netContainerInfo, found := info[dockertools.PodInfraContainerName]
 | 
						netContainerInfo, found := info[dockertools.PodInfraContainerName]
 | 
				
			||||||
	if found {
 | 
						if found {
 | 
				
			||||||
		podStatus.PodIP = netContainerInfo.PodIP
 | 
							podStatus.PodIP = netContainerInfo.PodIP
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO(dchen1107): Change Info to list from map
 | 
					 | 
				
			||||||
	podStatus.Info = info
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return podStatus, nil
 | 
						return podStatus, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user