mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Convert existing kubernetes system to use ContainerStatus, instead of
docker.Container directly. Conflicts: pkg/kubelet/dockertools/docker.go pkg/registry/pod/rest.go
This commit is contained in:
		@@ -18,7 +18,7 @@
 | 
				
			|||||||
# we're being called by hack/e2e-test.sh (we use some env vars it sets up).
 | 
					# we're being called by hack/e2e-test.sh (we use some env vars it sets up).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Exit on error
 | 
					# Exit on error
 | 
				
			||||||
set -e
 | 
					set -x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source "${KUBE_REPO_ROOT}/cluster/kube-env.sh"
 | 
					source "${KUBE_REPO_ROOT}/cluster/kube-env.sh"
 | 
				
			||||||
source "${KUBE_REPO_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh"
 | 
					source "${KUBE_REPO_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh"
 | 
				
			||||||
@@ -49,6 +49,8 @@ while [ $ALL_RUNNING -ne 1 ]; do
 | 
				
			|||||||
  sleep 5
 | 
					  sleep 5
 | 
				
			||||||
  ALL_RUNNING=1
 | 
					  ALL_RUNNING=1
 | 
				
			||||||
  for id in $POD_ID_LIST; do
 | 
					  for id in $POD_ID_LIST; do
 | 
				
			||||||
 | 
					echo "=========================================="
 | 
				
			||||||
 | 
					echo $KUBECFG
 | 
				
			||||||
    CURRENT_STATUS=$($KUBECFG -template '{{and .CurrentState.Info.mynginx.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id)
 | 
					    CURRENT_STATUS=$($KUBECFG -template '{{and .CurrentState.Info.mynginx.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id)
 | 
				
			||||||
    if [ "$CURRENT_STATUS" != "true" ]; then
 | 
					    if [ "$CURRENT_STATUS" != "true" ]; then
 | 
				
			||||||
      ALL_RUNNING=0
 | 
					      ALL_RUNNING=0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -288,8 +288,7 @@ type ContainerStatus struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodInfo contains one entry for every container with available info.
 | 
					// PodInfo contains one entry for every container with available info.
 | 
				
			||||||
// TODO(dchen1107): Replace docker.Container below with ContainerStatus defined above.
 | 
					type PodInfo map[string]ContainerStatus
 | 
				
			||||||
type PodInfo map[string]docker.Container
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RestartPolicyAlways struct{}
 | 
					type RestartPolicyAlways struct{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -301,7 +301,7 @@ type ContainerStatus struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodInfo contains one entry for every container with available info.
 | 
					// PodInfo contains one entry for every container with available info.
 | 
				
			||||||
type PodInfo map[string]docker.Container
 | 
					type PodInfo map[string]ContainerStatus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RestartPolicyAlways struct{}
 | 
					type RestartPolicyAlways struct{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,9 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func TestHTTPPodInfoGetter(t *testing.T) {
 | 
					func TestHTTPPodInfoGetter(t *testing.T) {
 | 
				
			||||||
	expectObj := api.PodInfo{
 | 
						expectObj := api.PodInfo{
 | 
				
			||||||
		"myID": docker.Container{ID: "myID"},
 | 
							"myID": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "myID"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	body, err := json.Marshal(expectObj)
 | 
						body, err := json.Marshal(expectObj)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -67,14 +69,17 @@ func TestHTTPPodInfoGetter(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// reflect.DeepEqual(expectObj, gotObj) doesn't handle blank times well
 | 
						// reflect.DeepEqual(expectObj, gotObj) doesn't handle blank times well
 | 
				
			||||||
	if len(gotObj) != len(expectObj) || expectObj["myID"].ID != gotObj["myID"].ID {
 | 
						if len(gotObj) != len(expectObj) ||
 | 
				
			||||||
 | 
							expectObj["myID"].DetailInfo.ID != gotObj["myID"].DetailInfo.ID {
 | 
				
			||||||
		t.Errorf("Unexpected response.  Expected: %#v, received %#v", expectObj, gotObj)
 | 
							t.Errorf("Unexpected response.  Expected: %#v, received %#v", expectObj, gotObj)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestHTTPPodInfoGetterNotFound(t *testing.T) {
 | 
					func TestHTTPPodInfoGetterNotFound(t *testing.T) {
 | 
				
			||||||
	expectObj := api.PodInfo{
 | 
						expectObj := api.PodInfo{
 | 
				
			||||||
		"myID": docker.Container{ID: "myID"},
 | 
							"myID": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "myID"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_, err := json.Marshal(expectObj)
 | 
						_, err := json.Marshal(expectObj)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -228,6 +228,25 @@ func GetKubeletDockerContainerLogs(client DockerInterface, containerID, tail str
 | 
				
			|||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func generateContainerStatus(inspectResult *docker.Container) api.ContainerStatus {
 | 
				
			||||||
 | 
						if inspectResult == nil {
 | 
				
			||||||
 | 
							// Why did we not get an error?
 | 
				
			||||||
 | 
							return api.ContainerStatus{}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var containerStatus api.ContainerStatus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if inspectResult.State.Running {
 | 
				
			||||||
 | 
							containerStatus.State.Running = &api.ContainerStateRunning{}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							containerStatus.State.Termination = &api.ContainerStateTerminated{
 | 
				
			||||||
 | 
								ExitCode: inspectResult.State.ExitCode,
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						containerStatus.DetailInfo = *inspectResult
 | 
				
			||||||
 | 
						return containerStatus
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ErrNoContainersInPod is returned when there are no containers for a given pod
 | 
					// ErrNoContainersInPod is returned when there are no containers for a given pod
 | 
				
			||||||
var ErrNoContainersInPod = errors.New("no containers exist for this pod")
 | 
					var ErrNoContainersInPod = errors.New("no containers exist for this pod")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -249,7 +268,9 @@ func GetDockerPodInfo(client DockerInterface, podFullName, uuid string) (api.Pod
 | 
				
			|||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// We assume docker return us a list of containers in time order
 | 
							// We assume docker return us a list of containers in time order
 | 
				
			||||||
		if _, ok := info[dockerContainerName]; ok {
 | 
							if containerStatus, found := info[dockerContainerName]; found {
 | 
				
			||||||
 | 
								containerStatus.RestartCount += 1
 | 
				
			||||||
 | 
								info[dockerContainerName] = containerStatus
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -257,12 +278,7 @@ func GetDockerPodInfo(client DockerInterface, podFullName, uuid string) (api.Pod
 | 
				
			|||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if inspectResult == nil {
 | 
							info[dockerContainerName] = generateContainerStatus(inspectResult)
 | 
				
			||||||
			// Why did we not get an error?
 | 
					 | 
				
			||||||
			info[dockerContainerName] = docker.Container{}
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			info[dockerContainerName] = *inspectResult
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(info) == 0 {
 | 
						if len(info) == 0 {
 | 
				
			||||||
		return nil, ErrNoContainersInPod
 | 
							return nil, ErrNoContainersInPod
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,8 +77,8 @@ func (h *httpActionHandler) Run(podFullName, uuid string, container *api.Contain
 | 
				
			|||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		netInfo, found := info[networkContainerName]
 | 
							netInfo, found := info[networkContainerName]
 | 
				
			||||||
		if found && netInfo.NetworkSettings != nil {
 | 
							if found && netInfo.DetailInfo.NetworkSettings != nil {
 | 
				
			||||||
			host = netInfo.NetworkSettings.IPAddress
 | 
								host = netInfo.DetailInfo.NetworkSettings.IPAddress
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			return fmt.Errorf("failed to find networking container: %v", info)
 | 
								return fmt.Errorf("failed to find networking container: %v", info)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -488,8 +488,8 @@ func (kl *Kubelet) syncPod(pod *Pod, dockerContainers dockertools.DockerContaine
 | 
				
			|||||||
			podFullName, uuid)
 | 
								podFullName, uuid)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	netInfo, found := info[networkContainerName]
 | 
						netInfo, found := info[networkContainerName]
 | 
				
			||||||
	if found && netInfo.NetworkSettings != nil {
 | 
						if found && netInfo.DetailInfo.NetworkSettings != nil {
 | 
				
			||||||
		podState.PodIP = netInfo.NetworkSettings.IPAddress
 | 
							podState.PodIP = netInfo.DetailInfo.NetworkSettings.IPAddress
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, container := range pod.Manifest.Containers {
 | 
						for _, container := range pod.Manifest.Containers {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,7 +146,11 @@ func TestContainers(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func TestPodInfo(t *testing.T) {
 | 
					func TestPodInfo(t *testing.T) {
 | 
				
			||||||
	fw := newServerTest()
 | 
						fw := newServerTest()
 | 
				
			||||||
	expected := api.PodInfo{"goodpod": docker.Container{ID: "myContainerID"}}
 | 
						expected := api.PodInfo{
 | 
				
			||||||
 | 
							"goodpod": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "myContainerID"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	fw.fakeKubelet.infoFunc = func(name string) (api.PodInfo, error) {
 | 
						fw.fakeKubelet.infoFunc = func(name string) (api.PodInfo, error) {
 | 
				
			||||||
		if name == "goodpod.etcd" {
 | 
							if name == "goodpod.etcd" {
 | 
				
			||||||
			return expected, nil
 | 
								return expected, nil
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,11 @@ func (f *FakePodInfoGetter) GetPodInfo(host, id string) (api.PodInfo, error) {
 | 
				
			|||||||
func TestPodCacheGet(t *testing.T) {
 | 
					func TestPodCacheGet(t *testing.T) {
 | 
				
			||||||
	cache := NewPodCache(nil, nil)
 | 
						cache := NewPodCache(nil, nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	expected := api.PodInfo{"foo": docker.Container{ID: "foo"}}
 | 
						expected := api.PodInfo{
 | 
				
			||||||
 | 
							"foo": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "foo"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	cache.podInfo["foo"] = expected
 | 
						cache.podInfo["foo"] = expected
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	info, err := cache.GetPodInfo("host", "foo")
 | 
						info, err := cache.GetPodInfo("host", "foo")
 | 
				
			||||||
@@ -66,7 +70,11 @@ func TestPodCacheGetMissing(t *testing.T) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestPodGetPodInfoGetter(t *testing.T) {
 | 
					func TestPodGetPodInfoGetter(t *testing.T) {
 | 
				
			||||||
	expected := api.PodInfo{"foo": docker.Container{ID: "foo"}}
 | 
						expected := api.PodInfo{
 | 
				
			||||||
 | 
							"foo": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "foo"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	fake := FakePodInfoGetter{
 | 
						fake := FakePodInfoGetter{
 | 
				
			||||||
		data: expected,
 | 
							data: expected,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -98,7 +106,11 @@ func TestPodUpdateAllContainers(t *testing.T) {
 | 
				
			|||||||
	pods := []api.Pod{pod}
 | 
						pods := []api.Pod{pod}
 | 
				
			||||||
	mockRegistry := registrytest.NewPodRegistry(&api.PodList{Items: pods})
 | 
						mockRegistry := registrytest.NewPodRegistry(&api.PodList{Items: pods})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	expected := api.PodInfo{"foo": docker.Container{ID: "foo"}}
 | 
						expected := api.PodInfo{
 | 
				
			||||||
 | 
							"foo": api.ContainerStatus{
 | 
				
			||||||
 | 
								DetailInfo: docker.Container{ID: "foo"},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	fake := FakePodInfoGetter{
 | 
						fake := FakePodInfoGetter{
 | 
				
			||||||
		data: expected,
 | 
							data: expected,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -196,8 +196,8 @@ func (rs *REST) fillPodInfo(pod *api.Pod) {
 | 
				
			|||||||
		pod.CurrentState.Info = info
 | 
							pod.CurrentState.Info = info
 | 
				
			||||||
		netContainerInfo, ok := info["net"]
 | 
							netContainerInfo, ok := info["net"]
 | 
				
			||||||
		if ok {
 | 
							if ok {
 | 
				
			||||||
			if netContainerInfo.NetworkSettings != nil {
 | 
								if netContainerInfo.DetailInfo.NetworkSettings != nil {
 | 
				
			||||||
				pod.CurrentState.PodIP = netContainerInfo.NetworkSettings.IPAddress
 | 
									pod.CurrentState.PodIP = netContainerInfo.DetailInfo.NetworkSettings.IPAddress
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				glog.Warningf("No network settings: %#v", netContainerInfo)
 | 
									glog.Warningf("No network settings: %#v", netContainerInfo)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -253,11 +253,13 @@ func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus,
 | 
				
			|||||||
	stopped := 0
 | 
						stopped := 0
 | 
				
			||||||
	unknown := 0
 | 
						unknown := 0
 | 
				
			||||||
	for _, container := range pod.DesiredState.Manifest.Containers {
 | 
						for _, container := range pod.DesiredState.Manifest.Containers {
 | 
				
			||||||
		if info, ok := pod.CurrentState.Info[container.Name]; ok {
 | 
							if containerStatus, ok := pod.CurrentState.Info[container.Name]; ok {
 | 
				
			||||||
			if info.State.Running {
 | 
								if containerStatus.State.Running != nil {
 | 
				
			||||||
				running++
 | 
									running++
 | 
				
			||||||
			} else {
 | 
								} else if containerStatus.State.Termination != nil {
 | 
				
			||||||
				stopped++
 | 
									stopped++
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									unknown++
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			unknown++
 | 
								unknown++
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -360,14 +360,14 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
	currentState := api.PodState{
 | 
						currentState := api.PodState{
 | 
				
			||||||
		Host: "machine",
 | 
							Host: "machine",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	runningState := docker.Container{
 | 
						runningState := api.ContainerStatus{
 | 
				
			||||||
		State: docker.State{
 | 
							State: api.ContainerState{
 | 
				
			||||||
			Running: true,
 | 
								Running: &api.ContainerStateRunning{},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	stoppedState := docker.Container{
 | 
						stoppedState := api.ContainerStatus{
 | 
				
			||||||
		State: docker.State{
 | 
							State: api.ContainerState{
 | 
				
			||||||
			Running: false,
 | 
								Termination: &api.ContainerStateTerminated{},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -376,14 +376,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
		status api.PodStatus
 | 
							status api.PodStatus
 | 
				
			||||||
		test   string
 | 
							test   string
 | 
				
			||||||
	}{
 | 
						}{
 | 
				
			||||||
		{
 | 
							{&api.Pod{DesiredState: desiredState, CurrentState: currentState}, api.PodWaiting, "waiting"},
 | 
				
			||||||
			&api.Pod{
 | 
					 | 
				
			||||||
				DesiredState: desiredState,
 | 
					 | 
				
			||||||
				CurrentState: currentState,
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			api.PodWaiting,
 | 
					 | 
				
			||||||
			"waiting",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
@@ -398,7 +391,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": runningState,
 | 
											"containerA": runningState,
 | 
				
			||||||
						"containerB": runningState,
 | 
											"containerB": runningState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
@@ -412,7 +405,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": runningState,
 | 
											"containerA": runningState,
 | 
				
			||||||
						"containerB": runningState,
 | 
											"containerB": runningState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
@@ -426,7 +419,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": stoppedState,
 | 
											"containerA": stoppedState,
 | 
				
			||||||
						"containerB": stoppedState,
 | 
											"containerB": stoppedState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
@@ -440,7 +433,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": stoppedState,
 | 
											"containerA": stoppedState,
 | 
				
			||||||
						"containerB": stoppedState,
 | 
											"containerB": stoppedState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
@@ -454,7 +447,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": runningState,
 | 
											"containerA": runningState,
 | 
				
			||||||
						"containerB": stoppedState,
 | 
											"containerB": stoppedState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
@@ -468,7 +461,7 @@ func TestMakePodStatus(t *testing.T) {
 | 
				
			|||||||
			&api.Pod{
 | 
								&api.Pod{
 | 
				
			||||||
				DesiredState: desiredState,
 | 
									DesiredState: desiredState,
 | 
				
			||||||
				CurrentState: api.PodState{
 | 
									CurrentState: api.PodState{
 | 
				
			||||||
					Info: map[string]docker.Container{
 | 
										Info: map[string]api.ContainerStatus{
 | 
				
			||||||
						"containerA": runningState,
 | 
											"containerA": runningState,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
					Host: "machine",
 | 
										Host: "machine",
 | 
				
			||||||
@@ -566,12 +559,14 @@ func (f *FakePodInfoGetter) GetPodInfo(host, podID string) (api.PodInfo, error)
 | 
				
			|||||||
func TestFillPodInfo(t *testing.T) {
 | 
					func TestFillPodInfo(t *testing.T) {
 | 
				
			||||||
	expectedIP := "1.2.3.4"
 | 
						expectedIP := "1.2.3.4"
 | 
				
			||||||
	fakeGetter := FakePodInfoGetter{
 | 
						fakeGetter := FakePodInfoGetter{
 | 
				
			||||||
		info: map[string]docker.Container{
 | 
							info: map[string]api.ContainerStatus{
 | 
				
			||||||
			"net": {
 | 
								"net": {
 | 
				
			||||||
				ID:   "foobar",
 | 
									DetailInfo: docker.Container{
 | 
				
			||||||
				Path: "bin/run.sh",
 | 
										ID:   "foobar",
 | 
				
			||||||
				NetworkSettings: &docker.NetworkSettings{
 | 
										Path: "bin/run.sh",
 | 
				
			||||||
					IPAddress: expectedIP,
 | 
										NetworkSettings: &docker.NetworkSettings{
 | 
				
			||||||
 | 
											IPAddress: expectedIP,
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
@@ -592,10 +587,12 @@ func TestFillPodInfo(t *testing.T) {
 | 
				
			|||||||
func TestFillPodInfoNoData(t *testing.T) {
 | 
					func TestFillPodInfoNoData(t *testing.T) {
 | 
				
			||||||
	expectedIP := ""
 | 
						expectedIP := ""
 | 
				
			||||||
	fakeGetter := FakePodInfoGetter{
 | 
						fakeGetter := FakePodInfoGetter{
 | 
				
			||||||
		info: map[string]docker.Container{
 | 
							info: map[string]api.ContainerStatus{
 | 
				
			||||||
			"net": {
 | 
								"net": {
 | 
				
			||||||
				ID:   "foobar",
 | 
									DetailInfo: docker.Container{
 | 
				
			||||||
				Path: "bin/run.sh",
 | 
										ID:   "foobar",
 | 
				
			||||||
 | 
										Path: "bin/run.sh",
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user