From eed71a7920b5091c5d8136e35dcf162634f42774 Mon Sep 17 00:00:00 2001 From: ricolin Date: Fri, 30 Jun 2023 13:29:39 +0800 Subject: [PATCH] Add asap2 support for neutron Change-Id: I3822e0073e3a3b77ed795498084619ea02f34a84 --- neutron/Chart.yaml | 2 +- ...n-openvswitch-agent-init-netoffload.sh.tpl | 29 +++++++++++++++++++ neutron/templates/configmap-bin.yaml | 4 +++ neutron/templates/configmap-etc.yaml | 3 ++ neutron/templates/daemonset-ovs-agent.yaml | 20 +++++++++++++ neutron/values.yaml | 12 ++++++++ releasenotes/notes/neutron.yaml | 1 + 7 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 neutron/templates/bin/_neutron-openvswitch-agent-init-netoffload.sh.tpl diff --git a/neutron/Chart.yaml b/neutron/Chart.yaml index 1df9160a75..c7d811e188 100644 --- a/neutron/Chart.yaml +++ b/neutron/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Neutron name: neutron -version: 0.3.14 +version: 0.3.15 home: https://docs.openstack.org/neutron/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png sources: diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init-netoffload.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init-netoffload.sh.tpl new file mode 100644 index 0000000000..ea84eee6dc --- /dev/null +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init-netoffload.sh.tpl @@ -0,0 +1,29 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex + +# ASAP2 +for cfg in $(cat /tmp/netoffload | jq -r '(.asap2 // [])[] | @base64'); do + _jq() { + echo ${cfg} | base64 --decode | jq -r ${1} + } + + DEVICE=$(_jq '.dev') + VFS=$(_jq '.vfs') + + offloadctl enable asap2 ${DEVICE} --vfs ${VFS} +done diff --git a/neutron/templates/configmap-bin.yaml b/neutron/templates/configmap-bin.yaml index cee77235b0..e8e79d49cd 100644 --- a/neutron/templates/configmap-bin.yaml +++ b/neutron/templates/configmap-bin.yaml @@ -65,6 +65,10 @@ data: {{ tuple "bin/_neutron-openvswitch-agent-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} neutron-openvswitch-agent-init-modules.sh: | {{ tuple "bin/_neutron-openvswitch-agent-init-modules.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- if .Values.conf.netoffload.enabled }} + neutron-openvswitch-agent-init-netoffload.sh: | +{{ tuple "bin/_neutron-openvswitch-agent-init-netoffload.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- end }} neutron-openvswitch-agent-readiness.sh: | {{ tuple "bin/_neutron-openvswitch-agent-readiness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} neutron-openvswitch-agent-liveness.sh: | diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml index c8c37ed8ed..14d894acf6 100644 --- a/neutron/templates/configmap-etc.yaml +++ b/neutron/templates/configmap-etc.yaml @@ -304,6 +304,9 @@ data: neutron_sudoers: {{ $envAll.Values.conf.neutron_sudoers | b64enc }} rootwrap.conf: {{ $envAll.Values.conf.rootwrap | b64enc }} auto_bridge_add: {{ toJson $envAll.Values.conf.auto_bridge_add | b64enc }} +{{- if .Values.conf.netoffload.enabled }} + netoffload: {{ toJson $envAll.Values.conf.netoffload | b64enc }} +{{- end }} dpdk.conf: {{ toJson $envAll.Values.conf.ovs_dpdk | b64enc }} update_dpdk_bond_config: {{ $envAll.Values.conf.ovs_dpdk.update_dpdk_bond_config | toString | b64enc }} {{- if ( has "ovn" .Values.network.backend ) }} diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml index 5a2d03701a..82bbd36f31 100644 --- a/neutron/templates/daemonset-ovs-agent.yaml +++ b/neutron/templates/daemonset-ovs-agent.yaml @@ -92,6 +92,26 @@ spec: {{- if .Values.conf.ovs_dpdk.enabled }} - name: pci-devices mountPath: /sys/bus/pci/devices +{{- end }} +{{- if .Values.conf.netoffload.enabled }} + - name: netoffload +{{ tuple $envAll "netoffload" | include "helm-toolkit.snippets.image" | indent 10 }} +{{ dict "envAll" $envAll "application" "neutron_ovs_agent" "container" "netoffload" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} + command: + - /tmp/neutron-openvswitch-agent-init-netoffload.sh + volumeMounts: + - name: pod-tmp + mountPath: /tmp + - name: neutron-bin + mountPath: /tmp/neutron-openvswitch-agent-init-netoffload.sh + subPath: neutron-openvswitch-agent-init-netoffload.sh + readOnly: true + - name: neutron-etc + mountPath: /tmp/netoffload + subPath: netoffload + readOnly: true + - name: run + mountPath: /run {{- end }} - name: neutron-ovs-agent-init {{ tuple $envAll "neutron_openvswitch_agent" | include "helm-toolkit.snippets.image" | indent 10 }} diff --git a/neutron/values.yaml b/neutron/values.yaml index 9d88bb4aed..61624d6ef0 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -30,6 +30,7 @@ images: ks_user: docker.io/openstackhelm/heat:stein-ubuntu_bionic ks_service: docker.io/openstackhelm/heat:stein-ubuntu_bionic ks_endpoints: docker.io/openstackhelm/heat:stein-ubuntu_bionic + netoffload: ghcr.io/vexxhost/netoffload:v1.0.1 neutron_server: docker.io/openstackhelm/neutron:stein-ubuntu_bionic neutron_dhcp: docker.io/openstackhelm/neutron:stein-ubuntu_bionic neutron_metadata: docker.io/openstackhelm/neutron:stein-ubuntu_bionic @@ -540,6 +541,10 @@ pod: - SYS_CHROOT runAsUser: 0 readOnlyRootFilesystem: true + netoffload: + privileged: true + runAsUser: 0 + readOnlyRootFilesystem: true neutron_ovs_agent_init: privileged: true runAsUser: 0 @@ -2013,6 +2018,13 @@ conf: auto_bridge_add: br-ex: null + # Network off-loading configuration + netoffload: + enabled: false + asap2: + # - dev: enp97s0f0 + # vfs: 16 + # configuration of OVS DPDK bridges and NICs # this is a separate section and not part of the auto_bridge_add section # because additional parameters are needed diff --git a/releasenotes/notes/neutron.yaml b/releasenotes/notes/neutron.yaml index be97a78444..a12f23420b 100644 --- a/releasenotes/notes/neutron.yaml +++ b/releasenotes/notes/neutron.yaml @@ -56,4 +56,5 @@ neutron: - 0.3.12 Update oslo_messaging_RPCClient and get_rpc_transport - 0.3.13 Remove duplicated argument when running a liveness check - 0.3.14 Add 2023.1 overrides + - 0.3.15 Add asap2 support ...