Disable kubenet for local node e2e test.

This commit is contained in:
Random-Liu 2016-07-05 16:49:47 -07:00
parent d07328dc4a
commit 62337e7c44
5 changed files with 26 additions and 13 deletions

View File

@ -129,6 +129,6 @@ else
# Test using the host the script was run on
# Provided for backwards compatibility
"${ginkgo}" --focus=$focus --skip=$skip "${KUBE_ROOT}/test/e2e_node/" --report-dir=${report} \
-- --alsologtostderr --v 2 --node-name $(hostname) --build-services=true --start-services=true --stop-services=true
-- --alsologtostderr --v 2 --node-name $(hostname) --disable-kubenet=true --build-services=true --start-services=true --stop-services=true
exit $?
fi

View File

@ -99,6 +99,7 @@ deployment-label-key
deserialization-cache-size
dest-file
disable-filter
disable-kubenet
dns-port
dns-provider
dns-provider-config

View File

@ -41,11 +41,12 @@ var ginkgoFlags = flag.String("ginkgo-flags", "", "Passed to ginkgo to specify a
var sshOptionsMap map[string]string
const (
archiveName = "e2e_node_test.tar.gz"
CNI_RELEASE = "c864f0e1ea73719b8f4582402b0847064f9883b0"
archiveName = "e2e_node_test.tar.gz"
CNIRelease = "c864f0e1ea73719b8f4582402b0847064f9883b0"
CNIDirectory = "cni"
)
var CNI_URL = fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-%s.tar.gz", CNI_RELEASE)
var CNIURL = fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-%s.tar.gz", CNIRelease)
var hostnameIpOverrides = struct {
sync.RWMutex
@ -157,14 +158,6 @@ func RunRemote(archive string, host string, cleanup bool, junitFileNumber int, s
}
}
// Install the cni plugin. Note that /opt/cni does not get cleaned up after
// the test completes.
if _, err := RunSshCommand("ssh", GetHostnameOrIp(host), "--", "sh", "-c",
getSshCommand(" ; ", "sudo mkdir -p /opt/cni", fmt.Sprintf("sudo wget -O - %s | sudo tar -xz -C /opt/cni", CNI_URL))); err != nil {
// Exit failure with the error
return "", false, err
}
// Create the temp staging directory
glog.Infof("Staging test binaries on %s", host)
tmp := fmt.Sprintf("/tmp/gcloud-e2e-%d", rand.Int31())
@ -182,6 +175,15 @@ func RunRemote(archive string, host string, cleanup bool, junitFileNumber int, s
}()
}
// Install the cni plugin.
cniPath := filepath.Join(tmp, CNIDirectory)
if _, err := RunSshCommand("ssh", GetHostnameOrIp(host), "--", "sh", "-c",
getSshCommand(" ; ", fmt.Sprintf("sudo mkdir -p %s", cniPath),
fmt.Sprintf("sudo wget -O - %s | sudo tar -xz -C %s", CNIURL, cniPath))); err != nil {
// Exit failure with the error
return "", false, err
}
// Copy the archive to the staging directory
_, err = RunSshCommand("scp", archive, fmt.Sprintf("%s:%s/", GetHostnameOrIp(host), tmp))
if err != nil {

View File

@ -25,6 +25,7 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"reflect"
"strconv"
"strings"
@ -233,9 +234,17 @@ func (es *e2eService) startKubeletServer() (*killCmd, error) {
"--config", es.kubeletStaticPodDir,
"--file-check-frequency", "10s", // Check file frequently so tests won't wait too long
"--v", LOG_VERBOSITY_LEVEL, "--logtostderr",
"--network-plugin=kubenet",
"--pod-cidr=10.180.0.0/24", // Assign a fixed CIDR to the node because there is no node controller.
)
if !*disableKubenet {
cwd, err := os.Getwd()
if err != nil {
return nil, err
}
cmdArgs = append(cmdArgs,
"--network-plugin=kubenet",
"--network-plugin-dir", filepath.Join(cwd, CNIDirectory, "bin")) // Enable kubenet
}
cmd := exec.Command("sudo", cmdArgs...)
hcc := newHealthCheckCommand(
"http://127.0.0.1:10255/healthz",

View File

@ -26,6 +26,7 @@ import (
var kubeletAddress = flag.String("kubelet-address", "http://127.0.0.1:10255", "Host and port of the kubelet")
var apiServerAddress = flag.String("api-server-address", "http://127.0.0.1:8080", "Host and port of the api server")
var disableKubenet = flag.Bool("disable-kubenet", false, "If true, start kubelet without kubenet")
var buildServices = flag.Bool("build-services", true, "If true, build local executables")
var startServices = flag.Bool("start-services", true, "If true, start local node services")
var stopServices = flag.Bool("stop-services", true, "If true, stop local node services after running tests")