diff --git a/Makefile b/Makefile index a51e87d7f..dcaeb2110 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,14 @@ pkg/asset/internal/templates.go: $(GOFILES) mkdir -p $(dir $@) go generate pkg/asset/templates_gen.go +#TODO(aaron): Prompt because this is destructive +conformance-%: clean all + @cd hack/$*-node && vagrant destroy -f + @cd hack/$*-node && rm -rf cluster + @cd hack/$*-node && ./bootkube-up + @sleep 30 # Give addons a little time to start + @cd hack/$*-node && ./conformance-test.sh + vendor-$(VENDOR_VERSION): @echo "Creating k8s vendor dir: $@" @mkdir -p $@/k8s.io/kubernetes diff --git a/README.md b/README.md index 51d2796c7..b6fcc2725 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,22 @@ And optionally, to install into $GOPATH/bin: make install ``` +## Conformance Tests + +This repository includes scripts for running the Kubernetes conformance tests agains the [hack/single-node](hack/single-node) and [hack/multi-node](hack/multi-node) launched clusters. + +To run the conformance tests: + +``` +make conformance-single +``` + +or + +``` +make conformance-multi +``` + ## License bootkube is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details. diff --git a/hack/multi-node/Vagrantfile b/hack/multi-node/Vagrantfile index c7307ca86..03719bcac 100644 --- a/hack/multi-node/Vagrantfile +++ b/hack/multi-node/Vagrantfile @@ -10,9 +10,9 @@ Vagrant.require_version ">= 1.6.0" $update_channel = "alpha" $controller_count = 1 -$controller_vm_memory = 1024 +$controller_vm_memory = 2048 $worker_count = 1 -$worker_vm_memory = 1024 +$worker_vm_memory = 512 $etcd_count = 1 $etcd_vm_memory = 512 diff --git a/hack/multi-node/conformance-test.sh b/hack/multi-node/conformance-test.sh new file mode 100755 index 000000000..62a302629 --- /dev/null +++ b/hack/multi-node/conformance-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail + +ssh_key="$(vagrant ssh-config c1 | awk '/IdentityFile/ {print $2}' | tr -d '"')" +ssh_port="$(vagrant ssh-config c1 | awk '/Port [0-9]+/ {print $2}')" + +../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}" diff --git a/hack/single-node/conformance-test.sh b/hack/single-node/conformance-test.sh new file mode 100755 index 000000000..f94e5447f --- /dev/null +++ b/hack/single-node/conformance-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail + +ssh_key="$(vagrant ssh-config | awk '/IdentityFile/ {print $2}' | tr -d '"')" +ssh_port="$(vagrant ssh-config | awk '/Port [0-9]+/ {print $2}')" + +../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}" diff --git a/hack/tests/conformance-test.sh b/hack/tests/conformance-test.sh new file mode 100755 index 000000000..6ce6f37d8 --- /dev/null +++ b/hack/tests/conformance-test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -euo pipefail + +CONFORMANCE_VERSION=${CONFORMANCE_VERSION:-v1.2.4} + +usage() { + echo "USAGE:" + echo " $0 " + echo + exit 1 +} + +if [ $# -ne 3 ]; then + usage + exit 1 +fi + +ssh_host=$1 +ssh_port=$2 +ssh_key=$3 + +ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} \ + "mkdir -p /home/core/go/src/k8s.io/kubernetes && git clone https://github.com/kubernetes/kubernetes /home/core/go/src/k8s.io/kubernetes" + +RKT_OPTS=$(echo \ + "--volume=kc,kind=host,source=/home/core/cluster/auth/kubeconfig "\ + "--volume=k8s,kind=host,source=/home/core/go/src/k8s.io/kubernetes " \ + "--mount volume=kc,target=/kubeconfig " \ + "--mount volume=k8s,target=/go/src/k8s.io/kubernetes") + +# Init steps necessary to run conformance in docker://golang:1.6.2 container +INIT="apt-get update && apt-get install -y rsync" + +CONFORMANCE=$(echo \ + "cd /go/src/k8s.io/kubernetes && " \ + "git checkout ${CONFORMANCE_VERSION} && " \ + "make all WHAT=cmd/kubectl && " \ + "make all WHAT=github.com/onsi/ginkgo/ginkgo && " \ + "make all WHAT=test/e2e/e2e.test && " \ + "KUBECONFIG=/kubeconfig KUBERNETES_CONFORMANCE_TEST=Y hack/ginkgo-e2e.sh -ginkgo.focus='\[Conformance\]'") + +CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.6.2 --exec /bin/bash -- -c \"${INIT} && ${CONFORMANCE}\"" + +ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"