@@ -37,7 +37,7 @@ error_ret() {
37
37
exit 1
38
38
}
39
39
40
- while getopts " :n:a:im:d:v:ps :" opt; do
40
+ while getopts " :n:a:im:d:v:pe:c:s :" opt; do
41
41
case $opt in
42
42
n)
43
43
netmaster=$OPTARG
@@ -67,8 +67,29 @@ while getopts ":n:a:im:d:v:ps:" opt; do
67
67
p)
68
68
contiv_v2plugin_install=true
69
69
;;
70
+ e)
71
+ # etcd endpoint option
72
+ cluster_store_type=etcd
73
+ cluster_store_urls=$OPTARG
74
+ install_etcd=false
75
+ ;;
76
+ c)
77
+ # consul endpoint option
78
+ cluster_store_type=consul
79
+ cluster_store_urls=$OPTARG
80
+ install_etcd=false
81
+ ;;
70
82
s)
71
- cluster_store=$OPTARG
83
+ # backward compatibility
84
+ echo " -s option has been deprecated, use -e or -c instead"
85
+ local cluster_store=$OPTARG
86
+ if [[ " $cluster_store " =~ ^etcd://.+ ]]; then
87
+ cluster_store_type=etcd
88
+ cluster_store_urls=$( echo $cluster_store | sed s/etcd/http/)
89
+ elif [[ " $cluster_store " =~ ^consul://.+ ]]; then
90
+ cluster_store_type=consul
91
+ cluster_store_urls=$( echo $cluster_store | sed s/consul/http/)
92
+ fi
72
93
install_etcd=false
73
94
;;
74
95
:)
@@ -88,6 +109,15 @@ mkdir -p "$inventory"
88
109
host_inventory=" $inventory /contiv_hosts"
89
110
node_info=" $inventory /contiv_nodes"
90
111
112
+ # TODO: use python to generate the inventory
113
+ # This python generated inventory contains
114
+ # 1. groups and host
115
+ # 2. ssh info for each host
116
+ # 3. control interface for each host
117
+ # 4. data interface for each host
118
+ # 5. aci info
119
+ # 6. fwd_mode(bridge/routing), net_mode(vlan/vxlan), contiv_network_mode(standalone/aci)
120
+ # then below sed against env_file set rest of them, they should be combined as one
91
121
./install/genInventoryFile.py " $contiv_config " " $host_inventory " " $node_info " $contiv_network_mode $fwd_mode
92
122
93
123
if [ " $netmaster " = " " ]; then
@@ -131,13 +161,15 @@ if [ "$service_vip" == "" ]; then
131
161
service_vip=$netmaster
132
162
fi
133
163
134
- if [ " $cluster_store " == " " ]; then
135
- cluster_store=" etcd://localhost:2379"
164
+ if [ " $cluster_store " = " " ]; then
165
+ cluster_store_type=" etcd"
166
+ cluster_store_urls=" http://localhost:2379"
136
167
fi
137
168
138
169
# variables already replaced by build.sh will not pattern match
139
170
sed -i.bak ' s#__NETMASTER_IP__#' " $service_vip " ' #g' " $env_file "
140
- sed -i.bak ' s#__CLUSTER_STORE__#' " $cluster_store " ' #g' " $env_file "
171
+ sed -i.bak ' s#__CLUSTER_STORE_TYPE__#' " $cluster_store_type " ' #g' " $env_file "
172
+ sed -i.bak ' s#__CLUSTER_STORE_URLS__#' " $cluster_store_urls " ' #g' " $env_file "
141
173
sed -i.bak ' s#__DOCKER_RESET_CONTAINER_STATE__#false#g' " $env_file "
142
174
sed -i.bak ' s#__DOCKER_RESET_IMAGE_STATE__#false#g' " $env_file "
143
175
sed -i.bak ' s#__ETCD_CLEANUP_STATE__#false#g' " $env_file "
@@ -205,8 +237,6 @@ if [ "$unreachable" = "" ] && [ "$failed" = "" ]; then
205
237
echo " Please export DOCKER_HOST=tcp://$netmaster :2375 in your shell before proceeding"
206
238
echo " Contiv UI is available at https://$netmaster :10000"
207
239
echo " Please use the first run wizard or configure the setup as follows:"
208
- echo " Configure forwarding mode (optional, default is bridge)."
209
- echo " netctl global set --fwd-mode routing"
210
240
echo " Configure ACI mode (optional)"
211
241
echo " netctl global set --fabric-mode aci --vlan-range <start>-<end>"
212
242
echo " Create a default network"
0 commit comments