forked from codeready-toolchain/toolchain-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_toolchain.sh
executable file
·72 lines (65 loc) · 1.72 KB
/
setup_toolchain.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
#!/usr/bin/env bash
user_help() {
echo "Setup Toolchain"
echo "options:"
echo "-d, --dev-cluster-48-hrs setting up toolchain 48 hrs temparory dev cluster"
echo "-mn, --member-ns namespace where member-operator is running"
echo "-hn, --host-ns namespace where host-operator is running"
exit 0
}
while test $# -gt 0; do
case "$1" in
-h | --help)
user_help
;;
-mn | --member-ns)
shift
MEMBER_OPERATOR_NS=$1
shift
;;
-hn | --host-ns)
shift
HOST_OPERATOR_NS=$1
shift
;;
-d | --dev-cluster-48-hrs)
DEV_CLUSTER=true
shift
;;
*)
echo "$1 is not a recognized flag!"
user_help
exit 1
;;
esac
done
function assign_default_namespace_values {
if [[ -z ${MEMBER_OPERATOR_NS} ]]; then
export MEMBER_OPERATOR_NS=toolchain-member-operator
fi
if [[ -z ${HOST_OPERATOR_NS} ]]; then
export HOST_OPERATOR_NS=toolchain-host-operator
fi
}
function setup_cluster() {
echo "starting installtion of $1 cluster"
exec ./setup_cluster.sh -t $1 -hn $2 -mn $3 $4
echo "installation of $1 cluster is finished"
}
function setup_host_and_member_clusters() {
echo "setting up host and member cluster"
if [[ ${DEV_CLUSTER} == "true" ]]; then
setup_cluster host $HOST_OPERATOR_NS $MEMBER_OPERATOR_NS -d &
setup_cluster member $HOST_OPERATOR_NS $MEMBER_OPERATOR_NS -d &
else
setup_cluster host $HOST_OPERATOR_NS $MEMBER_OPERATOR_NS &
setup_cluster member $HOST_OPERATOR_NS $MEMBER_OPERATOR_NS &
fi
wait
}
function setup_kubefed() {
MEMBER_OPERATOR_NS=$MEMBER_OPERATOR_NS HOST_OPERATOR_NS=$HOST_OPERATOR_NS exec ./setup_kubefed.sh
}
assign_default_namespace_values
setup_host_and_member_clusters
setup_kubefed