diff --git a/bindata/network/ovn-kubernetes/006-ovs-node.yaml b/bindata/network/ovn-kubernetes/006-ovs-node.yaml index 5405d72d50..5f42fd6a5a 100644 --- a/bindata/network/ovn-kubernetes/006-ovs-node.yaml +++ b/bindata/network/ovn-kubernetes/006-ovs-node.yaml @@ -35,7 +35,7 @@ spec: containers: # ovsdb and ovs-vswitchd - name: ovs-daemons - image: {{.OvnImage}} + image: "{{.OvnImage}}" command: - /bin/bash - -c diff --git a/bindata/network/ovn-kubernetes/ovnkube-master.yaml b/bindata/network/ovn-kubernetes/ovnkube-master.yaml index 5659fc94a6..4957ab192c 100644 --- a/bindata/network/ovn-kubernetes/ovnkube-master.yaml +++ b/bindata/network/ovn-kubernetes/ovnkube-master.yaml @@ -51,7 +51,7 @@ spec: # (container) -> (host) # /etc/openvswitch -> /var/lib/ovn/etc - ovsdb data # /var/lib/openvswitch -> /var/lib/ovn/data - ovsdb pki state - # /run/openvswitch -> tmpfs - sockets & pids + # /run/openvswitch -> tmpfs - sockets # /env -> configmap env-overrides - debug overrides containers: # ovn-northd: convert network objects in nbdb to flows in sbdb @@ -70,7 +70,6 @@ spec: exec ovn-northd \ --no-chdir "-vconsole:${OVN_LOG_LEVEL}" -vfile:off \ - --pidfile=/var/run/openvswitch/ovn-northd.pid \ --ovnnb-db "{{.OVN_NB_DB_LIST}}" \ --ovnsb-db "{{.OVN_SB_DB_LIST}}" \ -p /ovn-cert/tls.key \ @@ -86,6 +85,8 @@ spec: name: var-lib-openvswitch - mountPath: /run/openvswitch/ name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /env name: env-overrides - mountPath: /ovn-cert # not needed, but useful when exec'ing in to pod. @@ -187,6 +188,8 @@ spec: name: var-lib-openvswitch - mountPath: /run/openvswitch/ name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /env name: env-overrides - mountPath: /ovn-cert @@ -294,6 +297,8 @@ spec: name: var-lib-openvswitch - mountPath: /run/openvswitch/ name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /env name: env-overrides - mountPath: /ovn-cert @@ -330,7 +335,7 @@ spec: fi # start nbctl daemon for caching - export OVN_NB_DAEMON=$(ovn-nbctl --pidfile=/run/openvswitch/ovnk-nbctl.pid \ + export OVN_NB_DAEMON=$(ovn-nbctl --pidfile=/tmp/ovnk-nbctl.pid \ --detach \ -p /ovn-cert/tls.key -c /ovn-cert/tls.crt -C /ovn-ca/ca-bundle.crt \ --db "{{.OVN_NB_DB_LIST}}") @@ -349,7 +354,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/bash", "-c", "kill $(cat /run/openvswitch/ovnk-nbctl.pid)"] + command: ["/bin/bash", "-c", "kill $(cat /tmp/ovnk-nbctl.pid) && unset OVN_NB_DAEMON"] volumeMounts: - mountPath: /etc/openvswitch/ name: etc-openvswitch @@ -359,6 +364,8 @@ spec: name: var-lib-openvswitch - mountPath: /run/openvswitch/ name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /run/ovnkube-config/ name: ovnkube-config - mountPath: /env @@ -395,6 +402,9 @@ spec: path: /var/lib/ovn/data - name: run-openvswitch emptyDir: {} + - name: run-ovn + hostPath: + path: /var/run/ovn - name: ovnkube-config configMap: name: ovnkube-config diff --git a/bindata/network/ovn-kubernetes/ovnkube-node.yaml b/bindata/network/ovn-kubernetes/ovnkube-node.yaml index 46cedd7a33..c6b28f801f 100644 --- a/bindata/network/ovn-kubernetes/ovnkube-node.yaml +++ b/bindata/network/ovn-kubernetes/ovnkube-node.yaml @@ -46,8 +46,16 @@ spec: source "/env/${K8S_NODE}" set +o allexport fi + # Determine the ovn rundir. + if [[ -f /usr/bin/ovn-appctl ]] ; then + # ovn-appctl is present. Use new ovn run dir path. + OVNCTL_DIR=ovn + else + # ovn-appctl is not present. Use openvswitch run dir path. + OVNCTL_DIR=openvswitch + fi exec ovn-controller unix:/var/run/openvswitch/db.sock -vfile:off \ - --no-chdir --pidfile=/var/run/openvswitch/ovn-controller.pid \ + --no-chdir --pidfile=/var/run/${OVNCTL_DIR}/ovn-controller.pid \ -p /ovn-cert/tls.key -c /ovn-cert/tls.crt -C /ovn-ca/ca-bundle.crt \ -vconsole:"${OVN_LOG_LEVEL}" securityContext: @@ -62,6 +70,8 @@ spec: volumeMounts: - mountPath: /run/openvswitch name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /etc/openvswitch name: etc-openvswitch - mountPath: /etc/ovn/ @@ -134,7 +144,6 @@ spec: --config-file=/run/ovnkube-config/ovnkube.conf \ --loglevel "${OVN_KUBE_LOG_LEVEL}" \ ${hybrid_overlay_flags} \ - --pidfile /var/run/openvswitch/ovnkube-node.pid \ --metrics-bind-address "0.0.0.0:9103" env: # for kubectl @@ -177,6 +186,8 @@ spec: name: host-var-lib-cni-networks-ovn-kubernetes - mountPath: /run/openvswitch name: run-openvswitch + - mountPath: /run/ovn/ + name: run-ovn - mountPath: /etc/openvswitch name: etc-openvswitch - mountPath: /etc/ovn/ @@ -222,7 +233,10 @@ spec: path: /var/lib/openvswitch/etc - name: run-openvswitch hostPath: - path: /run/openvswitch + path: /var/run/openvswitch + - name: run-ovn + hostPath: + path: /var/run/ovn # For CNI server - name: host-run-ovn-kubernetes hostPath: