mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
make private root dirs for integration test kubelets
This commit is contained in:
parent
6cd37637f5
commit
5b0a65e9a3
@ -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{}
|
||||||
|
Loading…
Reference in New Issue
Block a user