Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bindata/network/openshift-sdn/sdn-ovs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ spec:
if [[ ! -S /run/openvswitch/db.sock ]]; then
systemctl_restart ovsdb-server
fi
# We need to explicitly exit on SIGTERM, see https://github.com/openshift/cluster-dns-operator/issues/65
function quit {
exit 0
}
trap quit SIGTERM
# Don't need to worry about restoring flows; this can only change if we've rebooted
exec tail -F /host/var/log/openvswitch/ovs-vswitchd.log /host/var/log/openvswitch/ovsdb-server.log
tail --pid=$BASHPID -F /host/var/log/openvswitch/ovs-vswitchd.log /host/var/log/openvswitch/ovsdb-server.log &
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why does exec tail ... not exit when it gets a SIGTERM? Shouldn't that always exit? Bash is gone...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default in Linux (possibly Unix in general) pid 1 has SIGTERM set to ignore by default... For basically bad reasons this is still the default with pid namespaces; it clearly would have been better to change it but we can't now.

https://vagga.readthedocs.io/en/latest/pid1mode.html
https://hynek.me/articles/docker-signals/
etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OHHHHHHHH. Wow.

wait
else

echo "openvswitch is running in container"
Expand Down
9 changes: 8 additions & 1 deletion bindata/network/ovn-kubernetes/006-ovs-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@ spec:
if [[ ! -S /run/openvswitch/db.sock ]]; then
systemctl_restart ovsdb-server
fi
# We need to explicitly exit on SIGTERM, see https://github.com/openshift/cluster-dns-operator/issues/65
function quit {
exit 0
}
trap quit SIGTERM
# Don't need to worry about restoring flows; this can only change if we've rebooted
exec tail -F /host/var/log/openvswitch/ovs-vswitchd.log /host/var/log/openvswitch/ovsdb-server.log
tail --pid=$BASHPID -F /host/var/log/openvswitch/ovs-vswitchd.log /host/var/log/openvswitch/ovsdb-server.log &
wait
else
echo "$(date -Iseconds) - starting ovs-daemons"
chown -R openvswitch:openvswitch /run/openvswitch
chown -R openvswitch:openvswitch /etc/openvswitch
# We need to explicitly exit on SIGTERM, see https://github.com/openshift/cluster-dns-operator/issues/65
function quit {
# Don't allow ovs-vswitchd to clear datapath flows on exit
kill -9 $(cat /var/run/openvswitch/ovs-vswitchd.pid 2>/dev/null) 2>/dev/null || true
Expand Down