Adding remaining multicluster install tests (#8269)

This commit is contained in:
Nathan Mittler 2020-10-05 16:17:31 -07:00 committed by GitHub
parent 3ec33944ff
commit 76f87ce4bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 198 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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