From f2b8bacb2614b711f5048335424e3643eb0053a3 Mon Sep 17 00:00:00 2001 From: "rajesh.kudaka" Date: Thu, 23 Apr 2020 08:22:04 -0500 Subject: [PATCH] Set ctl socket ownership This is moved from neutron-ovs-agent init script[0] to openvswitch poststart to ensure that ovs ctl socket has the required permissions even if the openvswitch pods are restarted. [0] https://github.com/openstack/openstack-helm/blob/master/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl#L22-L25 Change-Id: I09e604576e2408a8dec9905d1ad070422351ed99 --- openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl | 8 ++++++++ openvswitch/templates/daemonset-ovs-vswitchd.yaml | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl b/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl index 23ef00d8c..3ba842e27 100644 --- a/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl +++ b/openvswitch/templates/bin/_openvswitch-vswitchd.sh.tpl @@ -107,4 +107,12 @@ function stop () { ovs-appctl -T1 -t /run/openvswitch/ovs-vswitchd.${PID}.ctl exit } +function poststart () { + # This enables the usage of 'ovs-appctl' from neutron-ovs-agent pod. + + PID=$(cat $OVS_PID) + OVS_CTL=/run/openvswitch/ovs-vswitchd.${PID}.ctl + chown {{ .Values.pod.user.nova.uid }}.{{ .Values.pod.user.nova.uid }} ${OVS_CTL} +} + $COMMAND diff --git a/openvswitch/templates/daemonset-ovs-vswitchd.yaml b/openvswitch/templates/daemonset-ovs-vswitchd.yaml index 41dcf8f03..8c6849b46 100644 --- a/openvswitch/templates/daemonset-ovs-vswitchd.yaml +++ b/openvswitch/templates/daemonset-ovs-vswitchd.yaml @@ -112,6 +112,11 @@ It should be handled through lcore and pmd core masks. */}} - /tmp/openvswitch-vswitchd.sh - start lifecycle: + postStart: + exec: + command: + - /tmp/openvswitch-vswitchd.sh + - poststart preStop: exec: command: