Skip to content

Commit

Permalink
Merged in fix/restart (pull request #4)
Browse files Browse the repository at this point in the history
fix: ovn restart issues

Approved-by: yanzhu@alauda.io <yanzhu@alauda.io>
  • Loading branch information
oilbeater committed Mar 28, 2019
2 parents 433fff2 + e04bc09 commit b57f441
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
1 change: 1 addition & 0 deletions dist/images/Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN mkdir -p /var/run/openvswitch && \
mkdir -p /etc/cni/net.d && \
mkdir -p /opt/cni/bin

COPY ovn-healthcheck.sh /root/ovn-healthcheck.sh
COPY start-ovs.sh /root/start-ovs.sh
COPY start-ovn.sh /root/start-ovn.sh

Expand Down
5 changes: 5 additions & 0 deletions dist/images/ovn-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail

ovn-nbctl show
ovn-sbctl show
13 changes: 7 additions & 6 deletions dist/images/start-ovn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ DB_NB_PORT=${1:-6641}
DB_SB_ADDR=${1:-0.0.0.0}
DB_SB_PORT=${1:-6642}

function quit {
/usr/share/openvswitch/scripts/ovn-ctl stop_ovsdb
/usr/share/openvswitch/scripts/ovn-ctl stop_northd
exit 0
}
trap quit EXIT

# Start ovn-northd, ovn-nb and ovn-sb
/usr/share/openvswitch/scripts/ovn-ctl restart_northd

# ovn-nb and ovn-sb listen on tcp ports for ovn-controller to connect
ovn-nbctl set-connection ptcp:${DB_NB_PORT}:${DB_NB_ADDR}
ovn-sbctl set-connection ptcp:${DB_SB_PORT}:${DB_SB_ADDR}

function quit {
/usr/share/openvswitch/scripts/ovn-ctl stop_northd
exit 0
}
trap quit SIGTERM

tail -f /var/log/openvswitch/ovn-northd.log
16 changes: 8 additions & 8 deletions dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ function wait_ovn_sb {
}
wait_ovn_sb

function quit {
/usr/share/openvswitch/scripts/ovs-ctl stop
/usr/share/openvswitch/scripts/ovn-ctl stop_controller
/usr/share/openvswitch/scripts/ovn-ctl stop_controller_vtep
exit 0
}
trap quit EXIT

# Start vswitchd
/usr/share/openvswitch/scripts/ovs-ctl restart --no-ovs-vswitchd --system-id=random
# Restrict the number of pthreads ovs-vswitchd creates to reduce the
Expand All @@ -43,12 +51,4 @@ ovs-vsctl set open . external-ids:ovn-remote=tcp:${OVN_SB_SERVICE_HOST}:${OVN_SB
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
ovs-vsctl set open . external-ids:ovn-encap-ip=${POD_IP}

function quit {
/usr/share/openvswitch/scripts/ovs-ctl stop
/usr/share/openvswitch/scripts/ovn-ctl stop_controller
/usr/share/openvswitch/scripts/ovn-ctl stop_controller_vtep
exit 0
}
trap quit SIGTERM

tail -f /var/log/openvswitch/ovs-vswitchd.log
5 changes: 5 additions & 0 deletions dist/yaml/kube-ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ spec:
selector:
matchLabels:
app: kube-ovn-controller
strategy:
rollingUpdate:
maxSurge: 0%
maxUnavailable: 100%
type: RollingUpdate
template:
metadata:
labels:
Expand Down
13 changes: 9 additions & 4 deletions dist/yaml/ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ metadata:
OVN components: northd, nb and sb.
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 0%
maxUnavailable: 100%
type: RollingUpdate
selector:
matchLabels:
app: ovn-central
Expand Down Expand Up @@ -179,14 +184,14 @@ spec:
readinessProbe:
exec:
command:
- ovn-nbctl
- show
- sh
- /root/ovn-healthcheck.sh
periodSeconds: 5
livenessProbe:
exec:
command:
- ovn-nbctl
- show
- sh
- /root/ovn-healthcheck.sh
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 5
Expand Down

0 comments on commit b57f441

Please sign in to comment.