File tree 3 files changed +34
-8
lines changed
3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
86
86
node_peers += [ "#{ node_name } =http://#{ node_addr } :2380,#{ node_name } =http://#{ node_addr } :7001" ]
87
87
consul_join_flag = if n > 0 then "-join #{ node_ips [ 0 ] } " else "" end
88
88
consul_bootstrap_flag = "-bootstrap-expect=3"
89
+ swarm_flag = "slave"
89
90
if num_nodes < 3 then
90
91
if n == 0 then
91
92
consul_bootstrap_flag = "-bootstrap"
93
+ swarm_flag = "master"
92
94
else
93
95
consul_bootstrap_flag = ""
96
+ swarm_flag = "slave"
94
97
end
95
98
end
96
99
config . vm . define node_name do |node |
@@ -136,15 +139,17 @@ set -x
136
139
-bind=#{ node_addr } -data-dir /opt/consul 0<&- &>/tmp/consul.log &) || exit 1
137
140
138
141
# start swarm
139
- (nohup #{ gopath_folder } /src/github.com/contiv/netplugin/scripts/start-swarm.sh #{ node_addr } > /tmp/start-swarm.log &) || exit 1
142
+ (nohup #{ gopath_folder } /src/github.com/contiv/netplugin/scripts/start-swarm.sh #{ node_addr } #{ swarm_flag } > /tmp/start-swarm.log &) || exit 1
140
143
141
144
SCRIPT
142
145
node . vm . provision "shell" , run : "always" do |s |
143
146
s . inline = provision_node
144
147
end
145
148
146
149
# forward netmaster port
147
- # node.vm.network "forwarded_port", guest: 9999, host: 8080 + n
150
+ if n == 0 then
151
+ node . vm . network "forwarded_port" , guest : 9999 , host : 8080
152
+ end
148
153
end
149
154
end
150
155
end
Original file line number Diff line number Diff line change 26
26
exit 1
27
27
fi
28
28
29
+ # stop netmaster and netplugin if they are running
30
+ killall netplugin
31
+ killall netmaster
32
+
33
+ # Cleanup etcd and consul state
29
34
etcdctl rm -recursive /contiv > /dev/null 2>&1
35
+ etcdctl rm -recursive /contiv.io > /dev/null 2>&1
30
36
curl -X DELETE http://localhost:8500/v1/kv/contiv? recurse > /dev/null 2>&1
37
+
38
+ # Cleanup ovs state
31
39
ovs-vsctl del-br contivVlanBridge > /dev/null 2>&1
32
40
ovs-vsctl del-br contivVxlanBridge > /dev/null 2>&1
33
41
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- USAGE=" Usage: $0 <node-addr>"
3
+ USAGE=" Usage: $0 <node-addr> <master|slave> "
4
4
5
- if [ $# -ne 1 ]; then
5
+ if [ $# -ne 2 ]; then
6
6
echo $USAGE
7
7
exit 1
8
8
fi
9
9
10
10
node_addr=$1
11
+ mode=$2
12
+ source /etc/profile.d/envvar.sh
11
13
12
14
echo " start-swarm waiting for etcd"
13
15
@@ -18,10 +20,21 @@ while [[ `etcdctl cluster-health | head -n 1` != "cluster is healthy" ]]; do
18
20
etcdctl cluster-health;
19
21
done
20
22
21
- echo " starting swarm on " $node_addr
22
-
23
+ echo " starting swarm in " $mode " mode on " $node_addr
24
+ echo " starting swarm join "
23
25
# Start swarm discovery
24
26
nohup /usr/bin/swarm join --advertise=$node_addr :2385 etcd://localhost:2379 > /tmp/swarm-join.log 2>&1 &
25
27
26
- # Start swarm manager
27
- nohup /usr/bin/swarm manage -H tcp://$node_addr :2375 etcd://localhost:2379 > /tmp/swarm-manage.log 2>&1 &
28
+ echo " starting netplugin"
29
+ # start netplugin
30
+ nohup /opt/gopath/bin/netplugin -native-integration=true > /tmp/netplugin.log 2>&1 &
31
+
32
+ if [[ $mode == " master" ]]; then
33
+ echo " starting swarm manager"
34
+ # Start swarm manager
35
+ nohup /usr/bin/swarm manage -H tcp://$node_addr :2375 etcd://localhost:2379 > /tmp/swarm-manage.log 2>&1 &
36
+
37
+ echo " starting netmaster"
38
+ # start netmaster
39
+ nohup /opt/gopath/bin/netmaster > /tmp/netmaster.log 2>&1 &
40
+ fi
You can’t perform that action at this time.
0 commit comments