Skip to content

Commit 057857f

Browse files
committed
v2plugin fixes
1 parent 50b6ffc commit 057857f

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ host-plugin-restart:
273273

274274
# complete workflow to create rootfs, create/enable plugin and start swarm-mode
275275
demo-v2plugin:
276-
CONTIV_V2PLUGIN_NAME="$${CONTIV_V2PLUGIN_NAME:-contiv/v2plugin:0.1}" CONTIV_DOCKER_VERSION="$${CONTIV_DOCKER_VERSION:-1.13.1}" CONTIV_DOCKER_SWARM="$${CONTIV_DOCKER_SWARM:-swarm_mode}" make ssh-build
276+
CONTIV_V2PLUGIN_NAME="$${CONTIV_V2PLUGIN_NAME:-contiv/v2plugin:0.1}" CONTIV_DOCKER_VERSION="$${CONTIV_DOCKER_VERSION:-1.13.1}" CONTIV_DOCKER_SWARM="$${CONTIV_DOCKER_SWARM:-classic_mode}" make ssh-build
277277
vagrant ssh netplugin-node1 -c 'bash -lc "source /etc/profile.d/envvar.sh && cd /opt/gopath/src/github.com/contiv/netplugin && make host-pluginfs-create && make host-plugin-restart && make host-swarm-restart"'
278278

279279
only-tar:

install/v2plugin/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
FROM alpine:3.5
44
MAINTAINER Cisco Contiv (https://contiv.github.io/)
55

6-
RUN mkdir -p /run/docker/plugins \
7-
&& mkdir -p /etc/openvswitch \
8-
&& mkdir -p /var/run/contiv/log \
6+
RUN mkdir -p /run/docker/plugins /etc/openvswitch /var/run/contiv/log \
97
&& echo 'http://dl-cdn.alpinelinux.org/alpine/v3.4/main' >> /etc/apk/repositories \
10-
&& apk --no-cache add openvswitch=2.5.0-r0 iptables
8+
&& apk --no-cache add openvswitch=2.5.0-r0 iptables ca-certificates openssl \
9+
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/andyshinn/alpine-pkg-glibc/master/sgerrand.rsa.pub \
10+
&& wget https://github.com/andyshinn/alpine-pkg-glibc/releases/download/2.23-r1/glibc-2.23-r1.apk \
11+
&& apk --no-cache add glibc-2.23-r1.apk
1112

1213
COPY netplugin netmaster netctl startcontiv.sh /
1314

install/v2plugin/startcontiv.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/bin/bash
2-
3-
set -e
1+
#!/bin/sh
42

53
### Pre-requisite on the host
64
# run a cluster store like etcd or consul
@@ -29,36 +27,38 @@ fi
2927
echo "Loading OVS" >> $BOOTUP_LOGFILE
3028
(modprobe openvswitch) || (echo "Load ovs FAILED!!! " >> $BOOTUP_LOGFILE && while true; do sleep 1; done)
3129

32-
echo "Starting OVS" >> $BOOTUP_LOGFILE
33-
/usr/share/openvswitch/scripts/ovs-ctl restart --system-id=random --with-logdir=/var/run/contiv/log
30+
echo " Cleaning up ovsdb files" >> $BOOTUP_LOGFILE
31+
rm -rf /var/run/openvswitch/*
32+
rm -rf /etc/openvswitch/conf.db
33+
rm -rf /etc/openvswitch/.conf.db.~lock~
34+
35+
echo " Creating OVS DB" >> $BOOTUP_LOGFILE
36+
(ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema) || (while true; do sleep 1; done)
37+
38+
echo " Starting OVSBD server " >> $BOOTUP_LOGFILE
39+
ovsdb-server --remote=punix:/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --log-file=/var/run/contiv/log/ovs-db.log -vsyslog:dbg -vfile:dbg --pidfile --detach /etc/openvswitch/conf.db >> $BOOTUP_LOGFILE
40+
echo " Starting ovs-vswitchd " >> $BOOTUP_LOGFILE
41+
ovs-vswitchd -v --pidfile --detach --log-file=/var/run/contiv/log/ovs-vswitchd.log -vconsole:err -vsyslog:info -vfile:info &
42+
ovs-vsctl set-manager tcp:127.0.0.1:6640
43+
ovs-vsctl set-manager ptcp:6640
44+
45+
echo "Started OVS" >> $BOOTUP_LOGFILE
3446

3547
echo "Starting Netplugin " >> $BOOTUP_LOGFILE
36-
netplugin_retry="0"
37-
while [ true ]; do
48+
while true ; do
3849
echo "/netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg" >> $BOOTUP_LOGFILE
39-
/netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg &>> /var/run/contiv/log/netplugin.log
40-
((netplugin_retry++))
41-
if [ $netplugin_retry == "10" ] ; then
42-
echo "Giving up after $netplugin_retry retries" >> $BOOTUP_LOGFILE
43-
exit
44-
fi
45-
echo "CRITICAL : Net Plugin has exited, Respawn in 5" >> $BOOTUP_LOGFILE
50+
/netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg &> /var/run/contiv/log/netplugin.log
51+
echo "CRITICAL : Net Plugin has exited, Respawn in 5s" >> $BOOTUP_LOGFILE
4652
sleep 5
4753
echo "Restarting Netplugin " >> $BOOTUP_LOGFILE
4854
done &
4955

5056
if [ $plugin_role == "master" ]; then
5157
echo "Starting Netmaster " >> $BOOTUP_LOGFILE
52-
netmaster_retry=0
53-
while [ true ]; do
58+
while true ; do
5459
echo "/netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg " >> $BOOTUP_LOGFILE
55-
/netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg &>> /var/run/contiv/log/netmaster.log
56-
((netmaster_retry++))
57-
if [ $netmaster_retry == "10" ] ; then
58-
echo "Giving up after $netmaster_retry retries" >> $BOOTUP_LOGFILE
59-
exit
60-
fi
61-
echo "CRITICAL : Net Master has exited, Respawn in 5" >> $BOOTUP_LOGFILE
60+
/netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg &> /var/run/contiv/log/netmaster.log
61+
echo "CRITICAL : Net Master has exited, Respawn in 5s" >> $BOOTUP_LOGFILE
6262
echo "Restarting Netmaster " >> $BOOTUP_LOGFILE
6363
sleep 5
6464
done &

scripts/v2plugin_rootfs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# run this script from contiv/netplugin directory
44

55
echo "Creating rootfs for v2plugin ", ${CONTIV_V2PLUGIN_NAME}
6+
rm -rf install/v2plugin/rootfs
7+
rm install/v2plugin/config.json
68
cat install/v2plugin/config.template | grep -v "##" > install/v2plugin/config.json
79
sed -i "s%PluginName%${CONTIV_V2PLUGIN_NAME}%" install/v2plugin/config.json
810
cp bin/netplugin bin/netmaster bin/netctl install/v2plugin

0 commit comments

Comments
 (0)