diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index 6683d7c0b86..3872c0326f7 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "os" "reflect" "runtime" "sync" @@ -49,6 +50,8 @@ import ( "github.com/golang/glog" ) +const testRootDir = "/tmp/kubelet" + var ( fakeDocker1, fakeDocker2 dockertools.FakeDockerClient ) @@ -140,10 +143,11 @@ func startComponents(manifestURL string) (apiServerURL string) { controllerManager.Run(10 * time.Minute) // Kubelet (localhost) + os.MkdirAll(testRootDir, 0750) cfg1 := config.NewPodConfig(config.PodConfigNotificationSnapshotAndUpdates) config.NewSourceEtcd(config.EtcdKeyForHost(machineList[0]), etcdClient, cfg1.Channel("etcd")) config.NewSourceURL(manifestURL, 5*time.Second, cfg1.Channel("url")) - myKubelet := kubelet.NewIntegrationTestKubelet(machineList[0], &fakeDocker1) + myKubelet := kubelet.NewIntegrationTestKubelet(machineList[0], testRootDir, &fakeDocker1) go util.Forever(func() { myKubelet.Run(cfg1.Updates()) }, 0) go util.Forever(func() { kubelet.ListenAndServeKubeletServer(myKubelet, cfg1.Channel("http"), "localhost", 10250) @@ -154,7 +158,7 @@ func startComponents(manifestURL string) (apiServerURL string) { // have a place they can schedule. cfg2 := config.NewPodConfig(config.PodConfigNotificationSnapshotAndUpdates) config.NewSourceEtcd(config.EtcdKeyForHost(machineList[1]), etcdClient, cfg2.Channel("etcd")) - otherKubelet := kubelet.NewIntegrationTestKubelet(machineList[1], &fakeDocker2) + otherKubelet := kubelet.NewIntegrationTestKubelet(machineList[1], testRootDir, &fakeDocker2) go util.Forever(func() { otherKubelet.Run(cfg2.Updates()) }, 0) go util.Forever(func() { kubelet.ListenAndServeKubeletServer(otherKubelet, cfg2.Channel("http"), "localhost", 10251) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 5a7033d082e..e210038368b 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -89,10 +89,11 @@ func NewMainKubelet( // NewIntegrationTestKubelet creates a new Kubelet for use in integration tests. // TODO: add more integration tests, and expand parameter list as needed. -func NewIntegrationTestKubelet(hn string, dc dockertools.DockerInterface) *Kubelet { +func NewIntegrationTestKubelet(hn string, rd string, dc dockertools.DockerInterface) *Kubelet { return &Kubelet{ hostname: hn, dockerClient: dc, + rootDirectory: rd, dockerPuller: &dockertools.FakeDockerPuller{}, networkContainerImage: NetworkContainerImage, resyncInterval: 3 * time.Second,