Merge pull request #29486 from vishh/gci-node-e2e
Automatic merge from submit-queue Make it possible to run node e2e with GCI.
This commit is contained in:
commit
396254c11a
1
Makefile
1
Makefile
@ -157,6 +157,7 @@ test-e2e: ginkgo generated_files
|
|||||||
# IMAGES. Defaults to "kubernetes-node-e2e-images".
|
# IMAGES. Defaults to "kubernetes-node-e2e-images".
|
||||||
# INSTANCE_PREFIX: For REMOTE=true only. Instances created from images will
|
# INSTANCE_PREFIX: For REMOTE=true only. Instances created from images will
|
||||||
# have the name "${INSTANCE_PREFIX}-${IMAGE_NAME}". Defaults to "test".
|
# have the name "${INSTANCE_PREFIX}-${IMAGE_NAME}". Defaults to "test".
|
||||||
|
# INSTANCE_METADATA: For REMOTE=true and running on GCE only.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# make test-e2e-node FOCUS=Kubelet SKIP=container
|
# make test-e2e-node FOCUS=Kubelet SKIP=container
|
||||||
|
@ -51,6 +51,7 @@ Why run tests *Locally*? Much faster than running tests Remotely.
|
|||||||
Prerequisites:
|
Prerequisites:
|
||||||
- [Install etcd](https://github.com/coreos/etcd/releases) on your PATH
|
- [Install etcd](https://github.com/coreos/etcd/releases) on your PATH
|
||||||
- Verify etcd is installed correctly by running `which etcd`
|
- Verify etcd is installed correctly by running `which etcd`
|
||||||
|
- Or make etcd binary available and executable at `/tmp/etcd`
|
||||||
- [Install ginkgo](https://github.com/onsi/ginkgo) on your PATH
|
- [Install ginkgo](https://github.com/onsi/ginkgo) on your PATH
|
||||||
- Verify ginkgo is installed correctly by running `which ginkgo`
|
- Verify ginkgo is installed correctly by running `which ginkgo`
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ delete_instances=${DELETE_INSTANCES:-"false"}
|
|||||||
run_until_failure=${RUN_UNTIL_FAILURE:-"false"}
|
run_until_failure=${RUN_UNTIL_FAILURE:-"false"}
|
||||||
list_images=${LIST_IMAGES:-"false"}
|
list_images=${LIST_IMAGES:-"false"}
|
||||||
test_args=${TEST_ARGS:-""}
|
test_args=${TEST_ARGS:-""}
|
||||||
|
metadata=${INSTANCE_METADATA:-""}
|
||||||
|
|
||||||
if [[ $list_images == "true" ]]; then
|
if [[ $list_images == "true" ]]; then
|
||||||
gcloud compute images list --project="${image_project}" | grep "e2e-node"
|
gcloud compute images list --project="${image_project}" | grep "e2e-node"
|
||||||
@ -111,14 +112,14 @@ if [ $remote = true ] ; then
|
|||||||
echo "Images: $images"
|
echo "Images: $images"
|
||||||
echo "Hosts: $hosts"
|
echo "Hosts: $hosts"
|
||||||
echo "Ginkgo Flags: $ginkgoflags"
|
echo "Ginkgo Flags: $ginkgoflags"
|
||||||
|
echo "Instance Metadata: $metadata"
|
||||||
# Invoke the runner
|
# Invoke the runner
|
||||||
go run test/e2e_node/runner/run_e2e.go --logtostderr --vmodule=*=2 --ssh-env="gce" \
|
go run test/e2e_node/runner/run_e2e.go --logtostderr --vmodule=*=2 --ssh-env="gce" \
|
||||||
--zone="$zone" --project="$project" \
|
--zone="$zone" --project="$project" \
|
||||||
--hosts="$hosts" --images="$images" --cleanup="$cleanup" \
|
--hosts="$hosts" --images="$images" --cleanup="$cleanup" \
|
||||||
--results-dir="$artifacts" --ginkgo-flags="$ginkgoflags" \
|
--results-dir="$artifacts" --ginkgo-flags="$ginkgoflags" \
|
||||||
--image-project="$image_project" --instance-name-prefix="$instance_prefix" --setup-node="true" \
|
--image-project="$image_project" --instance-name-prefix="$instance_prefix" --setup-node="true" \
|
||||||
--delete-instances="$delete_instances" --test_args="$test_args"
|
--delete-instances="$delete_instances" --test_args="$test_args" --instance-metadata="$metadata"
|
||||||
exit $?
|
exit $?
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -135,7 +135,9 @@ var _ = AfterSuite(func() {
|
|||||||
func maskLocksmithdOnCoreos() {
|
func maskLocksmithdOnCoreos() {
|
||||||
data, err := ioutil.ReadFile("/etc/os-release")
|
data, err := ioutil.ReadFile("/etc/os-release")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Could not read /etc/os-release: %v", err)
|
// Not all distros contain this file.
|
||||||
|
glog.Infof("Could not read /etc/os-release: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if bytes.Contains(data, []byte("ID=coreos")) {
|
if bytes.Contains(data, []byte("ID=coreos")) {
|
||||||
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil {
|
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil {
|
||||||
|
@ -57,6 +57,8 @@ type logFileData struct {
|
|||||||
const (
|
const (
|
||||||
// This is consistent with the level used in a cluster e2e test.
|
// This is consistent with the level used in a cluster e2e test.
|
||||||
LOG_VERBOSITY_LEVEL = "4"
|
LOG_VERBOSITY_LEVEL = "4"
|
||||||
|
// Etcd binary is expected to either be available via PATH, or at this location.
|
||||||
|
defaultEtcdPath = "/tmp/etcd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newE2eService(nodeName string, cgroupsPerQOS bool) *e2eService {
|
func newE2eService(nodeName string, cgroupsPerQOS bool) *e2eService {
|
||||||
@ -179,7 +181,16 @@ func (es *e2eService) startEtcd() (*killCmd, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
es.etcdDataDir = dataDir
|
es.etcdDataDir = dataDir
|
||||||
cmd := exec.Command("etcd")
|
etcdPath, err := exec.LookPath("etcd")
|
||||||
|
if err != nil {
|
||||||
|
glog.Infof("etcd not found in PATH. Defaulting to %s...", defaultEtcdPath)
|
||||||
|
_, err = os.Stat(defaultEtcdPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("etcd binary not found")
|
||||||
|
}
|
||||||
|
etcdPath = defaultEtcdPath
|
||||||
|
}
|
||||||
|
cmd := exec.Command(etcdPath)
|
||||||
// Execute etcd in the data directory instead of using --data-dir because the flag sometimes requires additional
|
// Execute etcd in the data directory instead of using --data-dir because the flag sometimes requires additional
|
||||||
// configuration (e.g. --name in version 0.4.9)
|
// configuration (e.g. --name in version 0.4.9)
|
||||||
cmd.Dir = es.etcdDataDir
|
cmd.Dir = es.etcdDataDir
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#cloud-config
|
#cloud-config
|
||||||
|
|
||||||
runcmd:
|
runcmd:
|
||||||
|
- mount /tmp /tmp -o remount,exec,suid
|
||||||
- ETCD_VERSION=v2.2.5
|
- ETCD_VERSION=v2.2.5
|
||||||
- curl -L https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz -o /tmp/etcd.tar.gz
|
- curl -L https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz -o /tmp/etcd.tar.gz
|
||||||
- tar xzvf /tmp/etcd.tar.gz -C /tmp
|
- tar xzvf /tmp/etcd.tar.gz -C /tmp
|
||||||
- sudo mv /tmp/etcd-${ETCD_VERSION}-linux-amd64/etcd* /usr/local/bin/
|
- cp /tmp/etcd-${ETCD_VERSION}-linux-amd64/etcd* /tmp/
|
||||||
- sudo chown root:root /usr/local/bin/etcd*
|
- rm -rf /tmp/etcd-${ETCD_VERSION}-linux-amd64/
|
||||||
- rm -r /tmp/etcd*
|
|
||||||
|
@ -310,7 +310,9 @@ func createInstance(image, imageProject string) (string, error) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
if *instanceMetadata != "" {
|
if *instanceMetadata != "" {
|
||||||
|
glog.V(2).Infof("parsing instance metadata: %q", *instanceMetadata)
|
||||||
raw := parseInstanceMetadata(*instanceMetadata)
|
raw := parseInstanceMetadata(*instanceMetadata)
|
||||||
|
glog.V(3).Infof("parsed instance metadata: %v", raw)
|
||||||
i.Metadata = &compute.Metadata{}
|
i.Metadata = &compute.Metadata{}
|
||||||
metadata := []*compute.MetadataItems{}
|
metadata := []*compute.MetadataItems{}
|
||||||
for k, v := range raw {
|
for k, v := range raw {
|
||||||
@ -422,12 +424,12 @@ func parseInstanceMetadata(str string) map[string]string {
|
|||||||
}
|
}
|
||||||
kp := strings.Split(s, "<")
|
kp := strings.Split(s, "<")
|
||||||
if len(kp) != 2 {
|
if len(kp) != 2 {
|
||||||
glog.Errorf("Invalid instance metadata: %q", s)
|
glog.Fatalf("Invalid instance metadata: %q", s)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
v, err := ioutil.ReadFile(kp[1])
|
v, err := ioutil.ReadFile(kp[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to read metadata file %q: %v", kp[1], err)
|
glog.Fatalf("Failed to read metadata file %q: %v", kp[1], err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
metadata[kp[0]] = string(v)
|
metadata[kp[0]] = string(v)
|
||||||
|
Loading…
Reference in New Issue
Block a user