diff --git a/Makefile.overrides.mk b/Makefile.overrides.mk index 8375d9e425..1178aae377 100644 --- a/Makefile.overrides.mk +++ b/Makefile.overrides.mk @@ -19,4 +19,5 @@ CONTAINER_OPTIONS = -p 1313:1313 ${ADDITIONAL_CONTAINER_OPTIONS} BUILD_WITH_CONTAINER ?= 1 # The release branching scripts use git commands so mount the global .gitconfig into the container -CONDITIONAL_HOST_MOUNTS = --mount type=bind,source=${HOME}/.gitconfig,destination=/config/.gitconfig,readonly ${} \ No newline at end of file +CONDITIONAL_HOST_MOUNTS = --mount type=bind,source=${HOME}/.gitconfig,destination=/config/.gitconfig,readonly \ + --mount type=bind,source=/tmp,destination=/tmp ${} \ No newline at end of file diff --git a/prow/config/topology/multi-cluster.json b/prow/config/topology/multi-cluster.json new file mode 100644 index 0000000000..421fbd780d --- /dev/null +++ b/prow/config/topology/multi-cluster.json @@ -0,0 +1,26 @@ +[ + { + "cluster_name": "doc_cluster1", + "pod_subnet": "10.10.0.0/16", + "svc_subnet": "10.255.10.0/24", + "network_id": 0, + "control_plane_index": 0, + "config_index": 0 + }, + { + "cluster_name": "doc_cluster2", + "pod_subnet": "10.20.0.0/16", + "svc_subnet": "10.255.20.0/24", + "network_id": 0, + "control_plane_index": 0, + "config_index": 0 + }, + { + "cluster_name": "doc_cluster3", + "pod_subnet": "10.30.0.0/16", + "svc_subnet": "10.255.30.0/24", + "network_id": 1, + "control_plane_index": 0, + "config_index": 0 + } +] \ No newline at end of file diff --git a/prow/config/topology/single-cluster.json b/prow/config/topology/single-cluster.json new file mode 100644 index 0000000000..1037d9306a --- /dev/null +++ b/prow/config/topology/single-cluster.json @@ -0,0 +1,10 @@ +[ + { + "cluster_name": "istio-testing", + "pod_subnet": "10.10.0.0/16", + "svc_subnet": "10.96.0.0/12", + "network_id": 0, + "control_plane_index": 0, + "config_index": 0 + } +] \ No newline at end of file diff --git a/prow/integ-suite-kind.sh b/prow/integ-suite-kind.sh index 29b40571c6..7dab77e16c 100755 --- a/prow/integ-suite-kind.sh +++ b/prow/integ-suite-kind.sh @@ -29,8 +29,8 @@ set -u # Print commands set -x -# shellcheck source=prow/lib.sh -source "${ROOT}/prow/lib.sh" +# shellcheck source=common/scripts/kind_provisioner.sh +source "${ROOT}/common/scripts/kind_provisioner.sh" # KinD will not have a LoadBalancer, so we need to disable it export TEST_ENV=kind @@ -38,15 +38,71 @@ export TEST_ENV=kind # KinD will have the images loaded into it; it should not attempt to pull them # See https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster export PULL_POLICY=IfNotPresent - export HUB=${HUB:-"gcr.io/istio-testing"} # Setup junit report and verbose logging export T="${T:-"-v"}" export CI="true" +# TOPOLOGY must be specified. Based on that we pick the topology +# configuration file that is used to bring up KinD environment. +TOPOLOGY="SINGLE_CLUSTER" + +# This is relevant only when multicluster topology is picked +CLUSTER_TOPOLOGY_CONFIG_FILE="./prow/config/topology/multi-cluster.json" + +PARAMS=() + +while (( "$#" )); do + case $1 in + --topology) + case $2 in + SINGLE_CLUSTER | MULTICLUSTER) + TOPOLOGY=$2 + ;; + *) + echo "unknown topology: $2. Valid ones: SINGLE_CLUSTER, MULTICLUSTER" + exit 1 + ;; + esac + shift 2 + ;; + + --topology-config) + CLUSTER_TOPOLOGY_CONFIG_FILE=$2 + shift 2 + ;; + + -*) + echo "Error: unsupported flag: $1" >&2 + exit 1 + ;; + + *) + PARAMS+=("$1") + shift + ;; + esac +done + +export IP_FAMILY="${IP_FAMILY:-ipv4}" +export NODE_IMAGE="kindest/node:v1.18.2" + if [[ -z "${SKIP_SETUP:-}" ]]; then - time setup_kind_cluster "${NODE_IMAGE:-}" + export ARTIFACTS="${ARTIFACTS:-$(mktemp -d)}" + export DEFAULT_CLUSTER_YAML="./prow/config/trustworthy-jwt.yaml" + export METRICS_SERVER_CONFIG_DIR='' + + if [[ "${TOPOLOGY}" == "SINGLE_CLUSTER" ]]; then + time setup_kind_cluster + else + time load_cluster_topology "${CLUSTER_TOPOLOGY_CONFIG_FILE}" + time setup_kind_clusters "${NODE_IMAGE}" "${IP_FAMILY}" + + export TEST_ENV=kind-metallb + export DOCTEST_KUBECONFIG + DOCTEST_KUBECONFIG=$(IFS=':'; echo "${KUBECONFIGS[*]}") + fi fi -make "${@}" +make "${PARAMS[*]}"