Skip to content

Commit

Permalink
feat: grace stop ovn-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Sep 15, 2020
1 parent 8bd5b11 commit 77c4a5f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions dist/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ RUN curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VER
RUN --mount=type=bind,target=/rpms,from=ovs-rpm,source=/rpms rpm -ivh --nodeps /rpms/*.rpm

COPY *.sh /kube-ovn/
COPY grace_stop_ovn_controller /usr/share/ovn/scripts/grace_stop_ovn_controller
COPY 01-kube-ovn.conflist /kube-ovn/01-kube-ovn.conflist

WORKDIR /kube-ovn
Expand Down
40 changes: 40 additions & 0 deletions dist/images/grace_stop_ovn_controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

case $0 in
*/*) dir0=`echo "$0" | sed 's,/[^/]*$,,'`
ovsdir=`echo "$dir0" | sed 's,/ovn/scripts,,'`
ovsdir=$ovsdir/openvswitch/scripts
;;
*) dir0=./ ;;
esac
. "$ovsdir/ovs-lib" || exit 1
. "$dir0/ovn-lib" || exit 1

for dir in "$sbindir" "$ovn_bindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
case :$PATH: in
*:$dir:*) ;;
*) PATH=$PATH:$dir ;;
esac
done


ovnnb_active_conf_file="$ovn_etcdir/ovnnb-active.conf"
ovnsb_active_conf_file="$ovn_etcdir/ovnsb-active.conf"
ovn_northd_db_conf_file="$ovn_etcdir/ovn-northd-db-params.conf"
ic_nb_active_conf_file="$ovn_etcdir/ic-nb-active.conf"
ic_sb_active_conf_file="$ovn_etcdir/ic-sb-active.conf"
ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"

OVS_RUNDIR=${OVS_RUNDIR} stop_ovn_daemon ovn-controller --restart
2 changes: 1 addition & 1 deletion dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function wait_ovn_sb {
wait_ovn_sb

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

0 comments on commit 77c4a5f

Please sign in to comment.