From 76f87ce4bdfc7ee31ad2fda791792ef6560eb02b Mon Sep 17 00:00:00 2001 From: Nathan Mittler Date: Mon, 5 Oct 2020 16:17:31 -0700 Subject: [PATCH] Adding remaining multicluster install tests (#8269) --- .../docs/setup/install/multicluster/common.sh | 22 ++++--- .../multi-primary-multi-network-test.sh | 62 ++++++++++++++++++ .../multicluster/multi-primary-test.sh | 2 +- .../primary-remote-multi-network-test.sh | 63 +++++++++++++++++++ .../multicluster/primary-remote-test.sh | 58 +++++++++++++++++ 5 files changed, 198 insertions(+), 9 deletions(-) create mode 100644 content/en/docs/setup/install/multicluster/multi-primary-multi-network-test.sh create mode 100644 content/en/docs/setup/install/multicluster/primary-remote-multi-network-test.sh create mode 100644 content/en/docs/setup/install/multicluster/primary-remote-test.sh diff --git a/content/en/docs/setup/install/multicluster/common.sh b/content/en/docs/setup/install/multicluster/common.sh index 7a96ea30fd..b6341e6c61 100644 --- a/content/en/docs/setup/install/multicluster/common.sh +++ b/content/en/docs/setup/install/multicluster/common.sh @@ -21,6 +21,8 @@ _set_kube_vars # set_single_network_vars initializes all variables for a single network config. function set_single_network_vars { + export KUBECONFIG_CLUSTER1="${KUBECONFIG_FILES[0]}" + export KUBECONFIG_CLUSTER2="${KUBECONFIG_FILES[1]}" export CTX_CLUSTER1="${KUBE_CONTEXTS[0]}" export CTX_CLUSTER2="${KUBE_CONTEXTS[1]}" } @@ -28,15 +30,19 @@ function set_single_network_vars # set_multi_network_vars initializes all variables for a multi-network config. function set_multi_network_vars { + export KUBECONFIG_CLUSTER1="${KUBECONFIG_FILES[0]}" + export KUBECONFIG_CLUSTER2="${KUBECONFIG_FILES[2]}" export CTX_CLUSTER1="${KUBE_CONTEXTS[0]}" export CTX_CLUSTER2="${KUBE_CONTEXTS[2]}" } -# delete_namespaces removes the istio-system and sample namespaces on both -# CLUSTER1 and CLUSTER2. -function delete_namespaces() +# cleanup removes all resources created by the tests. +function cleanup() { - # Run the delete on both clusters concurrently + # Remove generated yaml files. + rm -f "cluster1.yaml" "cluster2.yaml" + + # Delete the namespaces on both clusters concurrently delete_namespaces_cluster1 & delete_namespaces_cluster2 & wait @@ -70,12 +76,12 @@ function verify_load_balancing() snip_deploy_sleep_3 # Wait for the deployments in CLUSTER1 - (KUBECONFIG="${KUBECONFIG_FILES[0]}"; _wait_for_deployment sample helloworld-v1) - (KUBECONFIG="${KUBECONFIG_FILES[0]}"; _wait_for_deployment sample sleep) + (KUBECONFIG="${KUBECONFIG_CLUSTER1}"; _wait_for_deployment sample helloworld-v1) + (KUBECONFIG="${KUBECONFIG_CLUSTER1}"; _wait_for_deployment sample sleep) # Wait for the deployments in CLUSTER2 - (KUBECONFIG="${KUBECONFIG_FILES[1]}"; _wait_for_deployment sample helloworld-v2) - (KUBECONFIG="${KUBECONFIG_FILES[1]}"; _wait_for_deployment sample sleep) + (KUBECONFIG="${KUBECONFIG_CLUSTER2}"; _wait_for_deployment sample helloworld-v2) + (KUBECONFIG="${KUBECONFIG_CLUSTER2}"; _wait_for_deployment sample sleep) local EXPECTED_RESPONSE_FROM_CLUSTER1="Hello version: v1, instance:" local EXPECTED_RESPONSE_FROM_CLUSTER2="Hello version: v2, instance:" diff --git a/content/en/docs/setup/install/multicluster/multi-primary-multi-network-test.sh b/content/en/docs/setup/install/multicluster/multi-primary-multi-network-test.sh new file mode 100644 index 0000000000..94d0bd6df1 --- /dev/null +++ b/content/en/docs/setup/install/multicluster/multi-primary-multi-network-test.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090,SC2154 + +# Copyright Istio Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# @setup multicluster + +set -e +set -u +set -o pipefail + +source content/en/docs/setup/install/multicluster/common.sh +set_multi_network_vars + +function install_istio_on_cluster1 { + snip_install_istio_7 + echo y | snip_install_istio_8 + + # Expose services through the east-west gateway. + snip_install_istio_9 + snip_install_istio_10 +} + +function install_istio_on_cluster2 { + snip_install_istio_11 + echo y | snip_install_istio_12 + + # Expose services through the east-west gateway. + snip_install_istio_13 + snip_install_istio_14 +} + +# Install Istio on the 2 clusters. Executing in +# parallel to reduce test time. +install_istio_on_cluster1 & +install_istio_on_cluster2 & +wait + +# Configure endpoint discovery. +snip_install_istio_15 +snip_install_istio_16 + +# Verify that traffic is properly load balanced. +verify_load_balancing + +# @cleanup +source content/en/docs/setup/install/multicluster/common.sh +set +e # ignore cleanup errors +set_multi_network_vars +cleanup diff --git a/content/en/docs/setup/install/multicluster/multi-primary-test.sh b/content/en/docs/setup/install/multicluster/multi-primary-test.sh index f2e17e5949..ddbab6e6b3 100755 --- a/content/en/docs/setup/install/multicluster/multi-primary-test.sh +++ b/content/en/docs/setup/install/multicluster/multi-primary-test.sh @@ -51,4 +51,4 @@ verify_load_balancing source content/en/docs/setup/install/multicluster/common.sh set +e # ignore cleanup errors set_single_network_vars -delete_namespaces +cleanup diff --git a/content/en/docs/setup/install/multicluster/primary-remote-multi-network-test.sh b/content/en/docs/setup/install/multicluster/primary-remote-multi-network-test.sh new file mode 100644 index 0000000000..cc6cba6552 --- /dev/null +++ b/content/en/docs/setup/install/multicluster/primary-remote-multi-network-test.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090,SC2154 + +# Copyright Istio Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# @setup multicluster + +set -e +set -u +set -o pipefail + +source content/en/docs/setup/install/multicluster/common.sh +set_multi_network_vars + +function install_istio_on_cluster1 { + snip_install_istio_25 + echo y | snip_install_istio_26 + + # Expose istiod and services via east-west gateway. + snip_install_istio_27 + snip_install_istio_28 + snip_install_istio_29 +} + +function install_istio_on_cluster2 { + snip_install_istio_30 + snip_install_istio_31 + echo y | snip_install_istio_32 + + # Expose services via east-west gateway + snip_install_istio_33 + snip_install_istio_34 +} + +# Install Istio on the 2 clusters. Executing in +# parallel to reduce test time. +install_istio_on_cluster1 & +install_istio_on_cluster2 & +wait + +# Configure endpoint discovery. +snip_install_istio_35 + +# Verify that traffic is properly load balanced. +verify_load_balancing + +# @cleanup +source content/en/docs/setup/install/multicluster/common.sh +set +e # ignore cleanup errors +set_multi_network_vars +cleanup diff --git a/content/en/docs/setup/install/multicluster/primary-remote-test.sh b/content/en/docs/setup/install/multicluster/primary-remote-test.sh new file mode 100644 index 0000000000..b296a9f4c0 --- /dev/null +++ b/content/en/docs/setup/install/multicluster/primary-remote-test.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090,SC2154 + +# Copyright Istio Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# @setup multicluster + +set -e +set -u +set -o pipefail + +source content/en/docs/setup/install/multicluster/common.sh +set_single_network_vars + +function install_istio_on_cluster1 { + snip_install_istio_17 + echo y | snip_install_istio_18 + + # Expose istiod via east-west gateway. + snip_install_istio_19 + snip_install_istio_20 +} + +function install_istio_on_cluster2 { + snip_install_istio_21 + snip_install_istio_22 + echo y | snip_install_istio_23 +} + +# Install Istio on the 2 clusters. Executing in +# parallel to reduce test time. +install_istio_on_cluster1 & +install_istio_on_cluster2 & +wait + +# Configure endpoint discovery. +snip_install_istio_24 + +# Verify that traffic is properly load balanced. +verify_load_balancing + +# @cleanup +source content/en/docs/setup/install/multicluster/common.sh +set +e # ignore cleanup errors +set_single_network_vars +cleanup