diff --git a/Makefile b/Makefile index b4933fe16..1fa7bfccd 100644 --- a/Makefile +++ b/Makefile @@ -68,8 +68,7 @@ help: # images - builds docker images for all of the components, saving them in your Docker daemon # images_push - pushes docker images to the target registry # crds - runs the update-crds script to ensure that generated CRDs are up to date - # cluster - creates a Kubernetes cluster for testing in CI, but doesn't install addons (KIND by default) - # ci-cluster - creates a Kubernetes cluster for testing in CI installing several required addons (KIND by default) + # cluster - creates a Kubernetes cluster for testing in CI but doesn't install addons (KIND by default) # release_tars - build the release tar files. # update_kind_images - updates the digests of the kind images used for testing + CI across various K8S versions # @@ -116,12 +115,10 @@ crds: .PHONY: cluster cluster: + # NB: don't use this on a development environment; this is specifically for CI. the docker network that this + # script creates can wreak havoc on in-cluster DNS by interfering with access to your local network! ./devel/ci-cluster.sh -.PHONY: ci-cluster -ci-cluster: cluster - ./devel/setup-e2e-deps.sh - .PHONY: update_kind_images update_kind_images: devel/cluster/kind_cluster_node_versions.sh diff --git a/devel/ci-cluster.sh b/devel/ci-cluster.sh index 3850534ab..92bfae51d 100755 --- a/devel/ci-cluster.sh +++ b/devel/ci-cluster.sh @@ -34,18 +34,31 @@ if [[ "$IS_OPENSHIFT" == "true" ]] ; then export SERVICE_IP_PREFIX="172.30.0" fi +# NB: kind will use a network called "kind" by default and so our creating a network by that name will be used for all clusters +# in the future, and that'll clobber anyone who has their local network on 192.168.0.0/16 (which will be true for most people at home) +# At the time of writing there's an env var - KIND_EXPERIMENTAL_DOCKER_NETWORK - which can be used to change +# the name of the network but it's marked as experimental and could be removed, so this note is here to warn that if you run +# this script locally, your cluster might not be able to talk to anything on your local network. +NETWORK_NAME="kind" + # When running in our CI environment the Docker network's subnet choice will -# cause issues with routing. This works this around till we have a way to -# properly patch this. -if ! docker network inspect kind ; then - docker network create --driver=bridge --subnet=192.168.0.0/16 --gateway 192.168.0.1 kind +# cause issues with routing, which can manifest in errors such as this one: +# > "dial tcp: lookup charts.jetstack.io on 10.8.240.10:53: read udp 10.8.0.2:54823->10.8.240.10:53: i/o timeout" +# https://prow.build-infra.jetstack.net/view/gs/jetstack-logs/pr-logs/pull/cert-manager_approver-policy/36/pull-cert-manager-approver-policy-smoke/1447565895923666944#1:build-log.txt%3A222 + +# We create this custom network as a workaround until we have a way to properly patch this. +if ! docker network inspect $NETWORK_NAME ; then + docker network create --driver=bridge --subnet=192.168.0.0/16 --gateway 192.168.0.1 $NETWORK_NAME fi # Wait for the network to be created so kind does not overwrite it. -while ! docker network inspect kind ; do +while ! docker network inspect $NETWORK_NAME ; do sleep 100ms done +# we could do this to use a custom network name, but we don't since it's experimental +# export KIND_EXPERIMENTAL_DOCKER_NETWORK=$NETWORK_NAME + echo "Ensuring a cluster exists..." if [[ "$IS_OPENSHIFT" == "true" ]] ; then if [[ "$OPENSHIFT_VERSION" =~ 3\..* ]] ; then