From 6588ba7ec093b3c461c297129eb6c1afedea7873 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 2 Nov 2020 18:12:56 +0000 Subject: [PATCH] Ensure tail processes exit with parent, catch SIGTERM in ovs-on-host We were proxying SIGTERM in the "ovs in container" path, we need to do the same with the ovs-on-host path. I think this will help avoid problems like https://bugzilla.redhat.com/show_bug.cgi?id=1893362 --- bindata/network/openshift-sdn/sdn-ovs.yaml | 8 +++++++- bindata/network/ovn-kubernetes/006-ovs-node.yaml | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bindata/network/openshift-sdn/sdn-ovs.yaml b/bindata/network/openshift-sdn/sdn-ovs.yaml index 00c1c43623..ae639d9ac5 100644 --- a/bindata/network/openshift-sdn/sdn-ovs.yaml +++ b/bindata/network/openshift-sdn/sdn-ovs.yaml @@ -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 & + wait else echo "openvswitch is running in container" diff --git a/bindata/network/ovn-kubernetes/006-ovs-node.yaml b/bindata/network/ovn-kubernetes/006-ovs-node.yaml index 3c7065db90..027d28af6e 100644 --- a/bindata/network/ovn-kubernetes/006-ovs-node.yaml +++ b/bindata/network/ovn-kubernetes/006-ovs-node.yaml @@ -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