-
Notifications
You must be signed in to change notification settings - Fork 0
/
istio-install.sh
70 lines (58 loc) · 1.85 KB
/
istio-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# Author Yuya Tinnefeld
#
# Function to start Minikube cluster
start_minikube_cluster() {
echo "############## START MINIKUBE CLUSTER ##############"
# Start Minikube with your desired configurations
minikube start --memory=8192 --cpus=4 --driver=hyperkit
# Check if Minikube started successfully
if [ $? -eq 0 ]; then
echo "Minikube cluster started successfully."
else
echo "Error: Minikube failed to start."
exit 1
fi
}
# Function to set up Istio environment
setup_istioctl() {
echo "############## SETUP ISTIO CTL ##############"
# Get current directory
export SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Verify the Istioctl version
export ISTIO_DIR=$(ls | grep istio-1)
# Set up the working directory path
export PATH="$PATH:$SCRIPTDIR/$ISTIO_DIR/bin"
echo "Istioctl is available now"
}
# Function to set up Istio environment
setup_istio_env() {
echo "############## INSTALL ISTIO PROFILE ##############"
# Install Istio profile
echo "Istio profile installing..."
istioctl install --set profile=demo -y
# Enable Istio injection for the default namespace
echo "############## ENABLE ISTIO INJECTION ##############"
kubectl label namespace default istio-injection=enabled
kubectl get ns default --show-labels
kubectl get namespace -L istio-injection
}
# 1. Check if Minikube IP is available
if ! minikube ip >/dev/null 2>&1; then
start_minikube_cluster
else
echo "Minikube IP is already available."
fi
# 2. Check if ISTIO CTL is available
if ! istioctl version >/dev/null 2>&1; then
setup_istioctl
else
echo "ISTIO CTL is already available."
fi
# 3. Check if ISTIO ENV is available
if ! istioctl verify-install >/dev/null 2>&1; then
setup_istio_env
else
echo "ISTIO ENV is already available."
fi