Created
July 19, 2020 17:27
-
-
Save mesmacosta/b963a9e5eb153922898364b0ff83b2be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Setting variables for GKE | |
| export CLUSTER_NAME="central" | |
| export CLUSTER_ZONE="us-central1-b" | |
| export CLUSTER_KUBECONFIG=$WORK_DIR/$CLUSTER_NAME.context | |
| # Variables for remote kops cluster | |
| export REMOTE_CLUSTER_NAME_BASE="remote" | |
| export REMOTE_CLUSTER_NAME=$REMOTE_CLUSTER_NAME_BASE.k8s.local | |
| export KOPS_STORE=gs://$PROJECT-kops-$REMOTE_CLUSTER_NAME_BASE | |
| export REMOTE_KUBECONFIG=$WORK_DIR/remote.context | |
| export NODE_COUNT=3 | |
| export NODE_SIZE=n1-standard-4 | |
| export ZONES=us-central1-a | |
| export INSTANCE_IP=$(curl -s api.ipify.org) | |
| export INSTANCE_CIDR=$INSTANCE_IP/32 | |
| # Variables for istio | |
| export ISTIO_DIR=$WORK_DIR/istio-$ISTIO_VERSION | |
| export ISTIO_CONFIG_DIR="$BASE_DIR/hybrid-multicluster/istio" | |
| set -e | |
| if [[ $OSTYPE == "linux-gnu" && $CLOUD_SHELL == true ]]; then | |
| ./common/install-tools.sh | |
| echo -e "\nMultiple tasks are running asynchronously to setup your environment. It may appear frozen, but you can check the logs in $WORK_DIR for additional details in another terminal window." | |
| ./gke/provision-gke.sh &> ${WORK_DIR}/provision-gke.log & | |
| ./connect-hub/provision-remote-gce.sh &> ${WORK_DIR}/provision-remote.log & | |
| wait | |
| kubectx central && ./config-management/install-config-operator.sh | |
| kubectx remote && ./config-management/install-config-operator.sh | |
| ./hybrid-multicluster/istio-install.sh | |
| #./service-mesh/enable-service-mesh.sh | |
| ./service-mesh/enable-asm-beta.sh | |
| else | |
| echo "This has only been tested in GCP Cloud Shell. Only Linux (debian) is supported". | |
| fi | |
| # Variables | |
| export PROJECT=$(gcloud config get-value project) | |
| export WORK_DIR=${WORK_DIR:="${PWD}/workdir"} | |
| ## Install Tools | |
| mkdir -p $WORK_DIR/bin | |
| echo "### " | |
| echo "### Begin Tools install" | |
| echo "### " | |
| ## Install tree | |
| if command -v tree 2>/dev/null; then | |
| echo "tree already installed." | |
| else | |
| echo "Installing tree..." | |
| sudo apt-get install tree | |
| sudo mv /usr/bin/tree $WORK_DIR/bin | |
| fi | |
| ## Install kubectx | |
| if command -v kubectx 2>/dev/null; then | |
| echo "kubectx already installed." | |
| else | |
| echo "Installing kubectx..." | |
| curl -sLO https://raw.githubusercontent.com/ahmetb/kubectx/"$KUBECTX_VERSION"/kubectx | |
| chmod +x kubectx | |
| mv kubectx $WORK_DIR/bin | |
| echo "kubectx installation complete." | |
| fi | |
| ## Install Istio | |
| if [ -d "$WORK_DIR/istio-$ISTIO_VERSION" ] && [ -x "$(command -v istioctl)" ]; then | |
| echo "Istio already installed." | |
| else | |
| echo "Downloading Istio..." | |
| curl -L https://git.io/getLatestIstio | ISTIO_VERSION=$ISTIO_VERSION sh - | |
| cp istio-$ISTIO_VERSION/bin/istioctl $WORK_DIR/bin/. | |
| mv istio-$ISTIO_VERSION $WORK_DIR/ | |
| fi | |
| ## Install kops | |
| if command -v kops 2>/dev/null; then | |
| echo "kops already installed." | |
| else | |
| echo "Installing kops..." | |
| curl -sLO https://github.com/kubernetes/kops/releases/download/$KOPS_VERSION/kops-linux-amd64 | |
| chmod +x kops-linux-amd64 | |
| mv kops-linux-amd64 $WORK_DIR/bin/kops | |
| echo "kops installation complete." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment