-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·65 lines (46 loc) · 2.68 KB
/
deploy.sh
File metadata and controls
executable file
·65 lines (46 loc) · 2.68 KB
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
#!/bin/bash
set -e
tar zxvf file/helm-linux-amd64.tar.gz --strip-components=1 -C /tmp/
mv /tmp/helm /usr/local/bin/helm3
chmod +x /usr/local/bin/helm3
MyImageRepositoryIP=`cat components.txt |grep "Harbor Address" |awk '{print $3}'`
MyImageRepositoryProject=library
IstioVersion=`cat components.txt |grep "Istio Version" |awk '{print $3}'`
######### Push images #########
docker load -i file/istio-images-$IstioVersion.tar
for file in $(cat file/images-list.txt); do docker tag $file $MyImageRepositoryIP/$MyImageRepositoryProject/${file##*/}; done
echo 'Images taged.'
for file in $(cat file/images-list.txt); do docker push $MyImageRepositoryIP/$MyImageRepositoryProject/${file##*/}; done
echo 'Images pushed.'
######### Update deploy yaml files #########
cd file
rm -rf istio-$IstioVersion
tar zxvf istio-$IstioVersion-origin.tar.gz
cd istio-$IstioVersion/install/kubernetes
sed -i "s/docker.io\/istio/$MyImageRepositoryIP\/$MyImageRepositoryProject/g" $(grep -lr "docker.io/istio" ./ |grep .yaml)
sed -i "s/docker.io\/prom/$MyImageRepositoryIP\/$MyImageRepositoryProject/g" $(grep -lr "docker.io/prom" ./ |grep .yaml)
sed -i "s/docker.io\/jaegertracing/$MyImageRepositoryIP\/$MyImageRepositoryProject/g" $(grep -lr "docker.io/jaegertracing" ./ |grep .yaml)
sed -i "s/grafana\/grafana/$MyImageRepositoryIP\/$MyImageRepositoryProject\/grafana/g" $(grep -lr "grafana/grafana" ./ |grep .yaml)
sed -i "s/quay.io\/kiali/$MyImageRepositoryIP\/$MyImageRepositoryProject/g" $(grep -lr "quay.io/kiali" ./ |grep .yaml)
cd ../../
# Istio init deploy
kubectl create ns istio-system
helm3 install install/kubernetes/helm/istio-init -g --namespace istio-system
set +e
######### Deploy Istio #########
# We need to verify that all 23 Istio CRDs were committed to the Kubernetes api-server
printf "Waiting for Istio to commit custom resource definitions..."
until [ `kubectl get crds |grep 'istio.io\|certmanager.k8s.io' |wc -l` -eq 23 ]; do printf "."; done
crdresult=""
for ((i=1; i<=23; i++)); do crdresult=${crdresult}"True"; done
until [ `for istiocrds in $(kubectl get crds |grep 'istio.io\|certmanager.k8s.io' |awk '{print $1}'); do kubectl get crd ${istiocrds} -o jsonpath='{.status.conditions[1].status}'; done` = $crdresult ]; do sleep 1; printf "."; done
echo 'Phase1 done!'
set -e
helm3 install install/kubernetes/helm/istio -g --namespace istio-system --set gateways.istio-ingressgateway.type=NodePort --values install/kubernetes/helm/istio/values-istio-demo.yaml
echo 'Phase2 done!'
cd ../../
kubectl apply -f template/kiali-service.yaml
kubectl apply -f template/jaeger-service.yaml
kubectl apply -f template/prometheus-service.yaml
kubectl apply -f template/grafana-service.yaml
echo 'NodePorts are set for services.'