-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_cam.sh
executable file
·75 lines (65 loc) · 1.55 KB
/
deploy_cam.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
71
72
73
74
75
function delete_log_pvc {
echo Deleting log PVC
kubectl delete pvc cam-logs-nfs
}
function create_log_pvc {
echo Deleting PVC
delete_log_pvc
echo Creating log PVC
kubectl create -f cam_config/cam_log_pvc.yaml
}
function wait_for_create_dirs_completion {
declare -i count
count=0
while [ $(kubectl get job | grep create-log-dirs | awk '{print $3}') -ne "1" ]
do
echo "Waiting for create dirs job... $count"
sleep 1
count=count+1
done
}
function deploy_create_log_dirs {
echo Creating log directories
cd cam_config
./deploy_create_log_dirs.sh
cd ..
}
function deploy_cam {
echo Deploing CAM
cd cam_install
helm install --name cam --set host.ip=$PROXY_IP --set license=accept cam
cd ..
}
function wait_for_deployments {
declare -i count
count=0
while [ $(kubectl get deploy |grep cam- | awk '{print $5}' | grep -v 1 | wc -c) -ne "0" ]
do
echo Waiting for deployments to complete... $count
sleep 1
count=count+1
done
}
function onboard_cam {
./cam_install/cam/scripts/onboard_cam.sh $PROXY_IP cam cam_config/ldap.env
}
function load_contents {
kubectl exec $(kubectl get pods | grep proxy | sed 's/[ ].*//g') \
/usr/src/app/camlibrary/importTemplatesToCatalog.sh $PROXY_IP testuser testuser
}
function display_message {
echo "================"
echo Congratulations!
echo CAM is available at https://$PROXY_IP:30000
echo user:testuser, pwd: testuser
echo Have fun!
}
./create_namespace.sh cam
create_log_pvc
deploy_create_log_dirs
wait_for_create_dirs_completion
deploy_cam
wait_for_deployments
onboard_cam
load_contents
display_message