Merge pull request #986 from munnerz/bazel-kind

Use kind provided by Bazel WORKSPACE
This commit is contained in:
jetstack-bot 2018-10-26 15:23:34 +01:00 committed by GitHub
commit d8e652c48e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 24 deletions

View File

@ -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",

View File

@ -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

View File

@ -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"},

View File

@ -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

View File

@ -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}"

View File

@ -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