Merge pull request #3396 from thockin/integ-root

make private root dirs for integration test kubelets
This commit is contained in:
Dawn Chen 2015-01-12 11:42:44 -08:00
commit fa152ab3f1

View File

@ -24,6 +24,7 @@ import (
"net" "net"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"os"
"reflect" "reflect"
"runtime" "runtime"
"strconv" "strconv"
@ -55,9 +56,6 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
) )
const testRootDir = "/tmp/kubelet"
const testRootDir2 = "/tmp/kubelet2"
var ( var (
fakeDocker1, fakeDocker2 dockertools.FakeDockerClient fakeDocker1, fakeDocker2 dockertools.FakeDockerClient
) )
@ -192,15 +190,30 @@ func startComponents(manifestURL string) (apiServerURL string) {
nodeController.Run(10 * time.Second) nodeController.Run(10 * time.Second)
// Kubelet (localhost) // Kubelet (localhost)
testRootDir := makeTempDirOrDie("kubelet_integ_1.")
glog.Infof("Using %s as root dir for kubelet #1", testRootDir)
standalone.SimpleRunKubelet(cl, etcdClient, &fakeDocker1, machineList[0], testRootDir, manifestURL, "127.0.0.1", 10250) standalone.SimpleRunKubelet(cl, etcdClient, &fakeDocker1, machineList[0], testRootDir, manifestURL, "127.0.0.1", 10250)
// Kubelet (machine) // Kubelet (machine)
// Create a second kubelet so that the guestbook example's two redis slaves both // Create a second kubelet so that the guestbook example's two redis slaves both
// have a place they can schedule. // have a place they can schedule.
standalone.SimpleRunKubelet(cl, etcdClient, &fakeDocker2, machineList[1], testRootDir2, "", "127.0.0.1", 10251) testRootDir = makeTempDirOrDie("kubelet_integ_2.")
glog.Infof("Using %s as root dir for kubelet #2", testRootDir)
standalone.SimpleRunKubelet(cl, etcdClient, &fakeDocker2, machineList[1], testRootDir, "", "127.0.0.1", 10251)
return apiServer.URL return apiServer.URL
} }
func makeTempDirOrDie(prefix string) string {
tempDir, err := ioutil.TempDir("/tmp", prefix)
if err != nil {
glog.Fatalf("Can't make a temp rootdir: %v", err)
}
if err = os.MkdirAll(tempDir, 0750); err != nil {
glog.Fatalf("Can't mkdir(%q): %v", tempDir, err)
}
return tempDir
}
// podsOnMinions returns true when all of the selected pods exist on a minion. // podsOnMinions returns true when all of the selected pods exist on a minion.
func podsOnMinions(c *client.Client, pods api.PodList) wait.ConditionFunc { func podsOnMinions(c *client.Client, pods api.PodList) wait.ConditionFunc {
podInfo := fakeKubeletClient{} podInfo := fakeKubeletClient{}