Skip to content

Commit

Permalink
Kubelet: a step towards to better encapsulation of docker functions
Browse files Browse the repository at this point in the history
We want to stop leaking more docker details into kubelet, and we also want to
consolidate some of the existing docker interfaces/structs. This change creates
DockerManager as the new home of some functions in dockertools/docker.go. It
also absorbs containerRunner. In addition, GetDockerPodStatus is renamed to
GetPodStatus with the entire pod passed to it so that it is simialr to the what
is defined in the container Runtime interface.

Eventually, DockerManager should implement the container Runtime interface, and
integrate DockerCache with a flag to turn on/off caching. Code in kubelet.go
should not be using docker client directly.
  • Loading branch information
yujuhong committed Apr 2, 2015
1 parent cdd6d0f commit d01bc66
Show file tree
Hide file tree
Showing 8 changed files with 546 additions and 524 deletions.
401 changes: 41 additions & 360 deletions pkg/kubelet/dockertools/docker.go

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion pkg/kubelet/dockertools/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
"github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
Expand Down Expand Up @@ -394,6 +395,8 @@ func TestIsImagePresent(t *testing.T) {

func TestGetRunningContainers(t *testing.T) {
fakeDocker := &FakeDockerClient{}
fakeRecorder := &record.FakeRecorder{}
containerManager := NewDockerManager(fakeDocker, fakeRecorder)
tests := []struct {
containers map[string]*docker.Container
inputIDs []string
Expand Down Expand Up @@ -476,7 +479,7 @@ func TestGetRunningContainers(t *testing.T) {
for _, test := range tests {
fakeDocker.ContainerMap = test.containers
fakeDocker.Err = test.err
if results, err := GetRunningContainers(fakeDocker, test.inputIDs); err == nil {
if results, err := containerManager.GetRunningContainers(test.inputIDs); err == nil {
resultIDs := []string{}
for _, result := range results {
resultIDs = append(resultIDs, result.ID)
Expand Down
Loading

0 comments on commit d01bc66

Please sign in to comment.