External control plane part 2 test (#10127)

* update for https://github.com/istio/istio.io/issues/10068

* update based on review

* update cleanup

* more cleanup and update doc
This commit is contained in:
AndreaM12345 2021-07-27 21:24:58 -05:00 committed by GitHub
parent d32b6a5157
commit c8297f13f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 3 deletions

View File

@ -496,8 +496,6 @@ including gateways, if needed.
## Adding clusters to the mesh (optional) {#adding-clusters} ## Adding clusters to the mesh (optional) {#adding-clusters}
{{< boilerplate experimental >}}
This section shows you how to expand an existing external control plane mesh to multicluster by adding another remote cluster. This section shows you how to expand an existing external control plane mesh to multicluster by adding another remote cluster.
This allows you to easily distribute services and use [location-aware routing and fail over](/docs/tasks/traffic-management/locality-load-balancing/) to support high availability of your application. This allows you to easily distribute services and use [location-aware routing and fail over](/docs/tasks/traffic-management/locality-load-balancing/) to support high availability of your application.

View File

@ -115,22 +115,62 @@ export GATEWAY_URL=$(kubectl \
_verify_contains snip_enable_gateways_6 "Hello version: v1" _verify_contains snip_enable_gateways_6 "Hello version: v1"
# Adding clusters to the mesh.
export CTX_SECOND_CLUSTER="${KUBE_CONTEXTS[1]}"
export SECOND_CLUSTER_NAME="${CTX_SECOND_CLUSTER}"
snip_get_second_config_cluster_iop
echo y | snip_register_the_new_cluster_2
# Confirm remote clusters webhook configuration has been installed
_verify_like snip_register_the_new_cluster_3 "$snip_register_the_new_cluster_3_out"
# Create a secret with credentials to allow the control plane to access the endpoints on the second remote cluster and install it
snip_register_the_new_cluster_4
# Setup east-west gateways
snip_setup_eastwest_gateways_1
snip_setup_eastwest_gateways_2
_verify_like snip_setup_eastwest_gateways_3 "$snip_setup_eastwest_gateways_3_out"
_verify_like snip_setup_eastwest_gateways_4 "$snip_setup_eastwest_gateways_4_out"
snip_setup_eastwest_gateways_5
snip_setup_eastwest_gateways_6
# Validate the installation.
snip_validate_the_installation_1
snip_validate_the_installation_2
_verify_like snip_validate_the_installation_3 "$snip_validate_the_installation_3_out"
_verify_contains snip_validate_the_installation_4 "Hello version:"
_verify_lines snip_validate_the_installation_5 "
+ Hello version: v1
+ Hello version: v2
"
# @cleanup # @cleanup
_set_kube_vars # helper function to initialize KUBECONFIG_FILES and KUBE_CONTEXTS _set_kube_vars # helper function to initialize KUBECONFIG_FILES and KUBE_CONTEXTS
export CTX_EXTERNAL_CLUSTER="${KUBE_CONTEXTS[0]}" export CTX_EXTERNAL_CLUSTER="${KUBE_CONTEXTS[0]}"
export CTX_REMOTE_CLUSTER="${KUBE_CONTEXTS[2]}" export CTX_REMOTE_CLUSTER="${KUBE_CONTEXTS[2]}"
export CTX_SECOND_CLUSTER="${KUBE_CONTEXTS[1]}"
# TODO put the cleanup instructions in the doc and then call the snips. # TODO put the cleanup instructions in the doc and then call the snips.
kubectl delete ns sample --context="${CTX_REMOTE_CLUSTER}" kubectl delete ns sample --context="${CTX_REMOTE_CLUSTER}"
kubectl delete ns sample --context="${CTX_SECOND_CLUSTER}"
kubectl delete -f external-istiod-gw.yaml --context="${CTX_EXTERNAL_CLUSTER}" kubectl delete -f external-istiod-gw.yaml --context="${CTX_EXTERNAL_CLUSTER}"
istioctl manifest generate -f remote-config-cluster.yaml | kubectl delete --context="${CTX_REMOTE_CLUSTER}" -f - istioctl manifest generate -f remote-config-cluster.yaml | kubectl delete --context="${CTX_REMOTE_CLUSTER}" -f -
istioctl manifest generate -f second-config-cluster.yaml | kubectl delete --context="${CTX_SECOND_CLUSTER}" -f -
istioctl manifest generate -f external-istiod.yaml | kubectl delete --context="${CTX_EXTERNAL_CLUSTER}" -f - istioctl manifest generate -f external-istiod.yaml | kubectl delete --context="${CTX_EXTERNAL_CLUSTER}" -f -
istioctl manifest generate -f controlplane-gateway.yaml | kubectl delete --context="${CTX_EXTERNAL_CLUSTER}" -f - istioctl manifest generate -f controlplane-gateway.yaml | kubectl delete --context="${CTX_EXTERNAL_CLUSTER}" -f -
istioctl manifest generate -f eastwest-gateway-1.yaml | kubectl delete --context="${CTX_REMOTE_CLUSTER}" -f -
istioctl manifest generate -f eastwest-gateway-2.yaml | kubectl delete --context="${CTX_SECOND_CLUSTER}" -f -
kubectl delete ns istio-system external-istiod --context="${CTX_EXTERNAL_CLUSTER}" kubectl delete ns istio-system external-istiod --context="${CTX_EXTERNAL_CLUSTER}"
kubectl delete ns external-istiod --context="${CTX_REMOTE_CLUSTER}" kubectl delete ns external-istiod --context="${CTX_REMOTE_CLUSTER}"
kubectl delete ns external-istiod --context="${CTX_SECOND_CLUSTER}"
kubectl delete ns istio-system --context="${CTX_REMOTE_CLUSTER}" # TODO: remove when https://github.com/istio/istio/issues/31495 fixed kubectl delete ns istio-system --context="${CTX_REMOTE_CLUSTER}" # TODO: remove when https://github.com/istio/istio/issues/31495 fixed
rm external-istiod-gw.yaml remote-config-cluster.yaml external-istiod.yaml controlplane-gateway.yaml rm external-istiod-gw.yaml remote-config-cluster.yaml external-istiod.yaml controlplane-gateway.yaml eastwest-gateway-1.yaml eastwest-gateway-2.yaml second-config-cluster.yaml