diff --git a/WORKSPACE b/WORKSPACE index f41625ad9..1b40a2a77 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -114,6 +114,13 @@ filegroup( """, ) +## Install 'kind', for creating kubernetes-in-docker clusters +go_repository( + name = "io_kubernetes_sigs_kind", + commit = "35d67a6310dd76e7737c44ebb6164fc757e1f919", + importpath = "sigs.k8s.io/kind", +) + ## Install buildozer, for mass-editing BUILD files http_file( name = "buildozer_darwin", diff --git a/docs/devel/end-to-end-tests.rst b/docs/devel/end-to-end-tests.rst index c3bf226fc..a86448c45 100644 --- a/docs/devel/end-to-end-tests.rst +++ b/docs/devel/end-to-end-tests.rst @@ -15,34 +15,23 @@ Requirements Currently, a number of tools **must** be installed on your machine in order to run the tests: +* ``bazel`` - As with all other development, Bazel is required to actually + build the project as well as end-to-end test framework. Bazel will also + retrieve appropriate versions of any other dependencies depending on what + 'target' you choose to run. + * ``docker`` - We provision a whole Kubernetes cluster within Docker, and so an up to date version of Docker must be installed. The oldest Docker version we have tested is 17.09. -* kind_ - This - tool is responsible for actually building and starting the Kubernetes cluster - used during tests. - -* helm_ - A minimum version 2.10 is required. - * ``kubectl`` - If you are running the tests on Linux, this step is technically not required. For non-Linux hosts (i.e. OSX), you will need to ensure you have a relatively new version of kubectl available on your PATH. -* ``golang`` - We require golang to build cert-manager and various test - related components. You should use at least go version 1.9, although we - currently build with go 1.11 in our own CI. - * An internet connection - tests require access to DNS, and optionally Cloudflare APIs (if a Cloudflare API token is provided). -Docker, helm and kubectl should be installed through your preferred means. - -``kind`` can be installed like so: - -.. code-block:: shell - - go install github.com/kubernetes-sigs/kind +Bazel, Docker and Kubectl should be installed through your preferred means. Run end-to-end tests ==================== @@ -53,8 +42,5 @@ You can run the end-to-end tests by executing the following: ./hack/ci/run-e2e-kind.sh -The full suite may take up to 20 minutes to run. +The full suite may take up to 10 minutes to run. You can monitor output of this command to track progress. - -.. _kind: https://github.com/kubernetes/test-infra/tree/master/kind -.. _helm: https://github.com/helm/helm diff --git a/hack/bin/BUILD.bazel b/hack/bin/BUILD.bazel index 522ce48c8..159918f51 100644 --- a/hack/bin/BUILD.bazel +++ b/hack/bin/BUILD.bazel @@ -55,6 +55,14 @@ genrule( visibility = ["//visibility:public"], ) +genrule( + name = "fetch_kind", + srcs = ["@io_kubernetes_sigs_kind//:kind"], + outs = ["kind"], + cmd = "cp $(SRCS) $@", + visibility = ["//visibility:public"], +) + config_setting( name = "k8", values = {"host_cpu": "k8"}, diff --git a/hack/ci/lib/cluster_create.sh b/hack/ci/lib/cluster_create.sh index 5f9522b2c..c031a0197 100755 --- a/hack/ci/lib/cluster_create.sh +++ b/hack/ci/lib/cluster_create.sh @@ -21,10 +21,14 @@ set -o pipefail SCRIPT_ROOT=$(dirname "${BASH_SOURCE}") source "${SCRIPT_ROOT}/lib.sh" +# build 'kind' +bazel build //hack/bin:kind +KIND="$(bazel info bazel-genfiles)/hack/bin/kind" + # deploy_kind will deploy a kubernetes-in-docker cluster deploy_kind() { # create the kind cluster - kind create cluster \ + "${KIND}" create cluster \ --name="${KIND_CLUSTER_NAME}" \ --image="${KIND_IMAGE}" \ --config "${REPO_ROOT}"/test/fixtures/kind-config.yaml diff --git a/hack/ci/lib/cluster_destroy.sh b/hack/ci/lib/cluster_destroy.sh index b373b88a5..c7d203317 100755 --- a/hack/ci/lib/cluster_destroy.sh +++ b/hack/ci/lib/cluster_destroy.sh @@ -21,4 +21,8 @@ set -o pipefail SCRIPT_ROOT=$(dirname "${BASH_SOURCE}") source "${SCRIPT_ROOT}/lib.sh" -kind delete cluster --name="${KIND_CLUSTER_NAME}" +# build 'kind' +bazel build //hack/bin:kind +KIND="$(bazel info bazel-genfiles)/hack/bin/kind" + +"${KIND}" delete cluster --name="${KIND_CLUSTER_NAME}" diff --git a/hack/ci/run-e2e-kind.sh b/hack/ci/run-e2e-kind.sh index 4e2f94554..1f964c19e 100755 --- a/hack/ci/run-e2e-kind.sh +++ b/hack/ci/run-e2e-kind.sh @@ -17,7 +17,7 @@ # This script will provision an end-to-end testing environment using 'kind' # (kubernetes-in-docker). # -# It requires 'kind', 'helm', 'kubectl' and 'docker' to be installed. +# It requires kubectl, docker and bazel to be installed. # kubectl will be automatically installed if not found when on linux set -o errexit