From 356bb51991df43b2d8101119284e272b642cf879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-R=C3=A9my=20Bancel?= Date: Tue, 29 Oct 2019 12:25:11 -0400 Subject: [PATCH] Stop assuming that !Gloo=Istio and that mesh is Istio only. (#5782) --- test/e2e-common.sh | 33 ++++++++++++++++----------------- test/e2e-tests.sh | 5 ++--- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/test/e2e-common.sh b/test/e2e-common.sh index a5e5f356bd07..def90e684b4e 100644 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -25,10 +25,9 @@ E2E_CLUSTER_MACHINE=${E2E_CLUSTER_MACHINE:-n1-standard-8} # This script provides helper methods to perform cluster actions. source $(dirname $0)/../vendor/knative.dev/test-infra/scripts/e2e-tests.sh -# Default Istio configuration to install: 1.2-latest, no mesh, cert manager 0.6.1. -ISTIO_VERSION="1.2-latest" -ISTIO_MESH=0 CERT_MANAGER_VERSION="0.9.1" +ISTIO_VERSION="" +GLOO_VERSION="" # Current YAMLs used to install Knative Serving. INSTALL_RELEASE_YAML="" @@ -60,11 +59,11 @@ function parse_flags() { return 2 ;; --mesh) - readonly ISTIO_MESH=1 + readonly MESH=1 return 1 ;; --no-mesh) - readonly ISTIO_MESH=0 + readonly MESH=0 return 1 ;; --install-monitoring) @@ -99,8 +98,8 @@ function parse_flags() { function build_knative_from_source() { local YAML_LIST="$(mktemp)" - # set ko flags to omit istio resources from generated YAMLs - if [[ -n "${GLOO_VERSION}" ]]; then + # Set ko flags to omit istio resources from generated YAMLs + if [[ -z "${ISTIO_VERSION}" ]]; then KO_FLAGS="${KO_FLAGS} --selector=networking.knative.dev/ingress-provider!=istio" fi @@ -138,7 +137,7 @@ function install_knative_serving() { function install_istio() { local istio_base="./third_party/istio-${ISTIO_VERSION}" INSTALL_ISTIO_CRD_YAML="${istio_base}/istio-crds.yaml" - (( ISTIO_MESH )) && INSTALL_ISTIO_YAML="${istio_base}/istio.yaml" || INSTALL_ISTIO_YAML="${istio_base}/istio-lean.yaml" + (( MESH )) && INSTALL_ISTIO_YAML="${istio_base}/istio.yaml" || INSTALL_ISTIO_YAML="${istio_base}/istio-lean.yaml" echo "Istio CRD YAML: ${INSTALL_ISTIO_CRD_YAML}" echo "Istio YAML: ${INSTALL_ISTIO_YAML}" @@ -194,11 +193,10 @@ function install_knative_serving_standard() { echo "Cert Manager YAML: ${INSTALL_CERT_MANAGER_YAML}" echo "Knative YAML: ${INSTALL_RELEASE_YAML}" - if [[ -z "${GLOO_VERSION}" ]]; then - # install istio as the default knative ingress + if [[ -n "${ISTIO_VERSION}" ]]; then install_istio - else - # install gloo if $GLOO_VERSION is provided + fi + if [[ -n "${GLOO_VERSION}" ]]; then install_gloo fi @@ -240,7 +238,7 @@ EOF kubectl -n knative-serving patch hpa activator --patch '{"spec":{"minReplicas":2}}' || return 1 # post-install steps for istio - if [[ -z "${GLOO_VERSION}" ]]; then + if [[ -n "${ISTIO_VERSION}" ]]; then # Due to the lack of Status in Istio, we have to ignore failures in initial requests. # # However, since network configurations may reach different ingress pods at slightly @@ -331,7 +329,7 @@ function test_setup() { echo ">> Creating test resources (test/config/)" ko apply ${KO_FLAGS} -f test/config/ || return 1 - if (( ISTIO_MESH )); then + if (( MESH )); then if [[ ${ISTIO_VERSION} =~ 1.3.* ]]; then # TODO: Enable mTLS with Istio 1.3 once https://github.com/knative/serving/issues/5725 is identified. continue @@ -341,10 +339,11 @@ function test_setup() { fi ${REPO_ROOT_DIR}/test/upload-test-images.sh || return 1 wait_until_pods_running knative-serving || return 1 - if [[ -z "${GLOO_VERSION}" ]]; then + if [[ -n "${ISTIO_VERSION}" ]]; then wait_until_pods_running istio-system || return 1 wait_until_service_has_external_ip istio-system istio-ingressgateway - else + fi + if [[ -n "${GLOO_VERSION}" ]]; then # we must set these override values to allow the test spoofing client to work with Gloo # see https://github.com/knative/pkg/blob/release-0.7/test/ingress/ingress.go#L37 export GATEWAY_OVERRIDE=knative-external-proxy @@ -361,7 +360,7 @@ function test_setup() { function test_teardown() { echo ">> Removing test resources (test/config/)" ko delete --ignore-not-found=true --now -f test/config/ - (( ISTIO_MESH )) && ko delete --ignore-not-found=true --now -f test/config/mtls/ + (( MESH )) && ko delete --ignore-not-found=true --now -f test/config/mtls/ echo ">> Ensuring test namespaces are clean" kubectl delete all --all --ignore-not-found --now --timeout 60s -n serving-tests kubectl delete --ignore-not-found --now --timeout 60s namespace serving-tests diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index d0dbf43dd340..8ae8e2221a7a 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -45,7 +45,7 @@ failed=0 # Run tests serially in the mesh scenario parallelism="" -(( ISTIO_MESH )) && parallelism="-parallel 1" +(( MESH )) && parallelism="-parallel 1" # Run conformance and e2e tests. go_test_e2e -timeout=30m \ @@ -60,8 +60,7 @@ go_test_e2e -timeout=10m \ ./test/scale || failed=1 # Istio E2E tests mutate the cluster and must be ran separately -# TODO(https://github.com/knative/test-infra/issues/1398): use proper flags instead of binary GLOO/no GLOO -if [[ -z "${GLOO_VERSION}" ]]; then +if [[ -n "${ISTIO_VERSION}" ]]; then go_test_e2e -timeout=10m \ ./test/e2e/istio \ "--resolvabledomain=$(use_resolvable_domain)" || failed=1