Merge pull request #39242 from NickrenREN/kuberuntime-manager

Automatic merge from submit-queue (batch tested with PRs 40392, 39242, 40579, 40628, 40713)

optimize podSandboxChanged() function and fix some function notes
This commit is contained in:
Kubernetes Submit Queue 2017-01-31 01:16:51 -08:00 committed by GitHub
commit fe01eef0bb

View File

@ -322,7 +322,7 @@ func (m *kubeGenericRuntimeManager) GetPods(all bool) ([]*kubecontainer.Pod, err
return result, nil return result, nil
} }
// containerToKillInfo contains neccessary information to kill a container. // containerToKillInfo contains necessary information to kill a container.
type containerToKillInfo struct { type containerToKillInfo struct {
// The spec of the container. // The spec of the container.
container *v1.Container container *v1.Container
@ -351,7 +351,7 @@ type podContainerSpecChanges struct {
ContainersToKeep map[kubecontainer.ContainerID]int ContainersToKeep map[kubecontainer.ContainerID]int
// ContainersToKill keeps a map of containers that need to be killed, note that // ContainersToKill keeps a map of containers that need to be killed, note that
// the key is the container ID of the container, while // the key is the container ID of the container, while
// the value contains neccessary information to kill a container. // the value contains necessary information to kill a container.
ContainersToKill map[kubecontainer.ContainerID]containerToKillInfo ContainersToKill map[kubecontainer.ContainerID]containerToKillInfo
// InitFailed indicates whether init containers are failed. // InitFailed indicates whether init containers are failed.
@ -364,7 +364,7 @@ type podContainerSpecChanges struct {
// podSandboxChanged checks whether the spec of the pod is changed and returns // podSandboxChanged checks whether the spec of the pod is changed and returns
// (changed, new attempt, original sandboxID if exist). // (changed, new attempt, original sandboxID if exist).
func (m *kubeGenericRuntimeManager) podSandboxChanged(pod *v1.Pod, podStatus *kubecontainer.PodStatus) (changed bool, attempt uint32, sandboxID string) { func (m *kubeGenericRuntimeManager) podSandboxChanged(pod *v1.Pod, podStatus *kubecontainer.PodStatus) (bool, uint32, string) {
if len(podStatus.SandboxStatuses) == 0 { if len(podStatus.SandboxStatuses) == 0 {
glog.V(2).Infof("No sandbox for pod %q can be found. Need to start a new one", format.Pod(pod)) glog.V(2).Infof("No sandbox for pod %q can be found. Need to start a new one", format.Pod(pod))
return true, 0, "" return true, 0, ""
@ -802,7 +802,7 @@ func (m *kubeGenericRuntimeManager) isHostNetwork(podSandBoxID string, pod *v1.P
} }
// GetPodStatus retrieves the status of the pod, including the // GetPodStatus retrieves the status of the pod, including the
// information of all containers in the pod that are visble in Runtime. // information of all containers in the pod that are visible in Runtime.
func (m *kubeGenericRuntimeManager) GetPodStatus(uid kubetypes.UID, name, namespace string) (*kubecontainer.PodStatus, error) { func (m *kubeGenericRuntimeManager) GetPodStatus(uid kubetypes.UID, name, namespace string) (*kubecontainer.PodStatus, error) {
// Now we retain restart count of container as a container label. Each time a container // Now we retain restart count of container as a container label. Each time a container
// restarts, pod will read the restart count from the registered dead container, increment // restarts, pod will read the restart count from the registered dead container, increment