Created
August 21, 2019 14:53
-
-
Save agonzalezro/15775ad8c565c4b85a927fce0e5292dd 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
#!/bin/bash | |
function startmsg { | |
echo -e "\e[32m[ ] $1\e[21m" | |
} | |
function endmsg { | |
echo -e "\e[1m\e[32m[x] $1\e[21m" | |
} | |
# Running on Kubernetes for Docker | |
export KIALI_URL=http://localhost:15029/kiali | |
export PROMETHEUS_URL=http://localhost:15030 | |
export GRAFANA_URL=http://localhost:15031 | |
export JAEGER_URL=http://localhost:15032/jaeger | |
startmsg "Checking prerequisites" | |
COMMANDS=(kubectl helm istioctl envsubst curl) | |
for CMD in "${COMMANDS[@]}" | |
do | |
which "$CMD" >/dev/null 2>&1 | |
if [ ! "$?" == "0" ]; then | |
echo "$CMD command not found. Aborting installation." | |
exit 1 | |
fi | |
done | |
endmsg "Checking prerequisites" | |
startmsg "Installing Istio and Kiali" | |
cd `mktemp -d` | |
wget https://github.com/istio/istio/releases/download/1.1.9/istio-1.1.9-osx.tar.gz | |
tar zxvf istio-1.1.9-osx.tar.gz | |
cd istio-1.1.9 | |
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin | |
kubectl create namespace istio-system | |
helm template install/kubernetes/helm/istio-init --name istio-init --namespace istio-system | kubectl apply -f - | |
CRDS=0 | |
for i in {1..30} | |
do | |
CRDS=$(kubectl get crds | grep 'istio.io\|certmanager.k8s.io' | wc -l) | |
if [ ! "$CRDS" == "53" ]; then | |
echo "[${i}] Waiting for CRDs..." | |
sleep 2 | |
else | |
break | |
fi | |
done | |
if [ ! "$CRDS" == "53" ]; then | |
echo "CRDs have not been created. Aborting installation." | |
fi | |
TMPKIALI=$(mktemp -d) | |
curl -L https://git.io/fjohL | envsubst > $TMPKIALI/update-kiali-cr.yaml | |
curl -L https://git.io/getLatestKialiOperator > $TMPKIALI/getLatestKialiOperator | |
sh $TMPKIALI/getLatestKialiOperator -oiv v1.0.0 --kiali-cr $TMPKIALI/update-kiali-cr.yaml | |
endmsg "Installing Istio and Kiali" | |
startmsg "Installing demo application" | |
helm template install/kubernetes/helm/istio --name istio --namespace istio-system \ | |
--values install/kubernetes/helm/istio/values-istio-demo.yaml | kubectl apply -f - | |
curl -L https://git.io/fj2rL | kubectl apply -f - | |
kubectl create namespace travel-agency | |
kubectl label namespace travel-agency istio-injection=enabled | |
TMPCURL=`mktemp` | |
curl -L https://git.io/fjoH0 > $TMPCURL | |
kubectl apply -f $TMPCURL -n travel-agency | |
kubectl create namespace travel-portal | |
kubectl label namespace travel-portal istio-injection=enabled | |
curl -L https://git.io/fjoQ1 > $TMPCURL | |
kubectl apply -f $TMPCURL -n travel-portal | |
endmsg "Installing demo application" | |
startmsg "Verifying everything is installed. Ctrl+C to continue..." | |
kubectl get pods --all-namespaces -w | |
echo "KIALI_URL=$KIALI_URL" | |
echo "PROMETHEUS_URL=$PROMETHEUS_URL" | |
echo "GRAFANA_URL=$GRAFANA_URL" | |
echo "JAEGER_URL=$JAEGER_URL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment