Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PodInfo to include last terminated container info when calling #1262

Merged
merged 1 commit into from
Sep 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions pkg/kubelet/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ func getRecentDockerContainersWithNameAndUUID(client DockerInterface, podFullNam
return result, nil
}

// ErrNoContainersInPod is returned when there are no running 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")

// GetDockerPodInfo returns docker info for all containers in the pod/manifest.
func getDockerPodInfo(client DockerInterface, podFullName, uuid string) (api.PodInfo, error) {
info := api.PodInfo{}

containers, err := client.ListContainers(docker.ListContainersOptions{})
containers, err := client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return nil, err
}
Expand All @@ -200,6 +200,11 @@ func getDockerPodInfo(client DockerInterface, podFullName, uuid string) (api.Pod
if uuid != "" && dockerUUID != uuid {
continue
}
// We assume docker return us a list of containers in time order
if _, ok := info[dockerContainerName]; ok {
continue
}

inspectResult, err := client.InspectContainer(value.ID)
if err != nil {
return nil, err
Expand Down