From e4b3a56eb8101d009608599abee33321f94116da Mon Sep 17 00:00:00 2001 From: Ivan Kolodiazhnyi Date: Tue, 19 Mar 2024 10:22:03 +0200 Subject: [PATCH] Deploy RDMA CNI as a part of SR-IOV Operator Signed-off-by: Ivan Kolodiazhnyi --- bindata/manifests/daemon/daemonset.yaml | 14 ++++++++++++++ controllers/sriovoperatorconfig_controller.go | 1 + controllers/suite_test.go | 2 ++ deploy/operator.yaml | 2 ++ deployment/sriov-network-operator/README.md | 1 + .../sriov-network-operator/templates/operator.yaml | 2 ++ deployment/sriov-network-operator/values.yaml | 1 + hack/env.sh | 4 ++++ hack/run-e2e-test.sh | 1 + 9 files changed, 28 insertions(+) diff --git a/bindata/manifests/daemon/daemonset.yaml b/bindata/manifests/daemon/daemonset.yaml index b5126ae28..1cdea47b4 100644 --- a/bindata/manifests/daemon/daemonset.yaml +++ b/bindata/manifests/daemon/daemonset.yaml @@ -92,6 +92,20 @@ spec: mountPath: /host/etc/os-release readOnly: true {{- end }} + {{- if .RDMACNIImage }} + - name: rdma-cni + image: {{.RDMACNIImage}} + args: ["--no-sleep"] + securityContext: + privileged: true + resources: + requests: + cpu: 10m + memory: 10Mi + volumeMounts: + - name: cnibin + mountPath: /host/opt/cni/bin + {{- end }} {{- if .UsedSystemdMode}} - name: sriov-service-copy image: {{.Image}} diff --git a/controllers/sriovoperatorconfig_controller.go b/controllers/sriovoperatorconfig_controller.go index 9e90a5688..d915af685 100644 --- a/controllers/sriovoperatorconfig_controller.go +++ b/controllers/sriovoperatorconfig_controller.go @@ -168,6 +168,7 @@ func (r *SriovOperatorConfigReconciler) syncConfigDaemonSet(ctx context.Context, data.Data["SRIOVCNIImage"] = os.Getenv("SRIOV_CNI_IMAGE") data.Data["SRIOVInfiniBandCNIImage"] = os.Getenv("SRIOV_INFINIBAND_CNI_IMAGE") data.Data["OVSCNIImage"] = os.Getenv("OVS_CNI_IMAGE") + data.Data["RDMACNIImage"] = os.Getenv("RDMA_CNI_IMAGE") data.Data["ReleaseVersion"] = os.Getenv("RELEASEVERSION") data.Data["ClusterType"] = vars.ClusterType data.Data["DevMode"] = os.Getenv("DEV_MODE") diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 4f42b687c..aab0d05c2 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -111,6 +111,8 @@ var _ = BeforeSuite(func() { Expect(err).NotTo(HaveOccurred()) err = os.Setenv("OVS_CNI_IMAGE", "mock-image") Expect(err).NotTo(HaveOccurred()) + err = os.Setenv("RDMA_CNI_IMAGE", "mock-image") + Expect(err).NotTo(HaveOccurred()) err = os.Setenv("SRIOV_DEVICE_PLUGIN_IMAGE", "mock-image") Expect(err).NotTo(HaveOccurred()) err = os.Setenv("NETWORK_RESOURCES_INJECTOR_IMAGE", "mock-image") diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 8d9f88cf2..c7b36e9d3 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -56,6 +56,8 @@ spec: value: $SRIOV_INFINIBAND_CNI_IMAGE - name: OVS_CNI_IMAGE value: $OVS_CNI_IMAGE + - name: RDMA_CNI_IMAGE + value: $RDMA_CNI_IMAGE - name: SRIOV_DEVICE_PLUGIN_IMAGE value: $SRIOV_DEVICE_PLUGIN_IMAGE - name: NETWORK_RESOURCES_INJECTOR_IMAGE diff --git a/deployment/sriov-network-operator/README.md b/deployment/sriov-network-operator/README.md index 9cabcee74..e1f249abf 100644 --- a/deployment/sriov-network-operator/README.md +++ b/deployment/sriov-network-operator/README.md @@ -125,6 +125,7 @@ This section contains general parameters that apply to both the operator and dae | `images.sriovCni` | SR-IOV CNI image | | `images.ibSriovCni` | InfiniBand SR-IOV CNI image | | `images.ovsCni` | OVS CNI image | +| `images.rdmaCni` | RDMA CNI image | | `images.sriovDevicePlugin` | SR-IOV device plugin image | | `images.resourcesInjector` | Resources Injector image | | `images.webhook` | Operator Webhook image | diff --git a/deployment/sriov-network-operator/templates/operator.yaml b/deployment/sriov-network-operator/templates/operator.yaml index 1200e34ac..9f1b6fa56 100644 --- a/deployment/sriov-network-operator/templates/operator.yaml +++ b/deployment/sriov-network-operator/templates/operator.yaml @@ -58,6 +58,8 @@ spec: value: {{ .Values.images.ibSriovCni }} - name: OVS_CNI_IMAGE value: {{ .Values.images.ovsCni }} + - name: RDMA_CNI_IMAGE + value: { { .Values.images.rdmaCni } } - name: SRIOV_DEVICE_PLUGIN_IMAGE value: {{ .Values.images.sriovDevicePlugin }} - name: NETWORK_RESOURCES_INJECTOR_IMAGE diff --git a/deployment/sriov-network-operator/values.yaml b/deployment/sriov-network-operator/values.yaml index 0799b35ea..e04a08c60 100644 --- a/deployment/sriov-network-operator/values.yaml +++ b/deployment/sriov-network-operator/values.yaml @@ -96,6 +96,7 @@ images: sriovCni: ghcr.io/k8snetworkplumbingwg/sriov-cni ibSriovCni: ghcr.io/k8snetworkplumbingwg/ib-sriov-cni ovsCni: quay.io/kubevirt/ovs-cni-plugin + rdmaCni: ghcr.io/k8snetworkplumbingwg/rdma-cni sriovDevicePlugin: ghcr.io/k8snetworkplumbingwg/sriov-network-device-plugin resourcesInjector: ghcr.io/k8snetworkplumbingwg/network-resources-injector webhook: ghcr.io/k8snetworkplumbingwg/sriov-network-operator-webhook diff --git a/hack/env.sh b/hack/env.sh index 26d9c767e..86ed45d46 100755 --- a/hack/env.sh +++ b/hack/env.sh @@ -3,6 +3,8 @@ if [ -z $SKIP_VAR_SET ]; then export SRIOV_INFINIBAND_CNI_IMAGE=${SRIOV_INFINIBAND_CNI_IMAGE:-ghcr.io/k8snetworkplumbingwg/ib-sriov-cni} # OVS_CNI_IMAGE can be explicitly set to empty value, use default only if the var is not set export OVS_CNI_IMAGE=${OVS_CNI_IMAGE-quay.io/kubevirt/ovs-cni-plugin} + # RDMA_CNI_IMAGE can be explicitly set to empty value, use default only if the var is not set + export RDMA_CNI_IMAGE=${RDMA_CNI_IMAGE-ghcr.io/k8snetworkplumbingwg/rdma-cni} export SRIOV_DEVICE_PLUGIN_IMAGE=${SRIOV_DEVICE_PLUGIN_IMAGE:-ghcr.io/k8snetworkplumbingwg/sriov-network-device-plugin} export NETWORK_RESOURCES_INJECTOR_IMAGE=${NETWORK_RESOURCES_INJECTOR_IMAGE:-ghcr.io/k8snetworkplumbingwg/network-resources-injector} export SRIOV_NETWORK_CONFIG_DAEMON_IMAGE=${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE:-ghcr.io/k8snetworkplumbingwg/sriov-network-operator-config-daemon} @@ -11,6 +13,8 @@ if [ -z $SKIP_VAR_SET ]; then else # ensure that OVS_CNI_IMAGE is set, empty string is a valid value OVS_CNI_IMAGE=${OVS_CNI_IMAGE:-} + # ensure that RDMA_CNI_IMAGE is set, empty string is a valid value + $RDMA_CNI_IMAGE=${$RDMA_CNI_IMAGE:-} [ -z $SRIOV_CNI_IMAGE ] && echo "SRIOV_CNI_IMAGE is empty but SKIP_VAR_SET is set" && exit 1 [ -z $SRIOV_INFINIBAND_CNI_IMAGE ] && echo "SRIOV_INFINIBAND_CNI_IMAGE is empty but SKIP_VAR_SET is set" && exit 1 [ -z $SRIOV_DEVICE_PLUGIN_IMAGE ] && echo "SRIOV_DEVICE_PLUGIN_IMAGE is empty but SKIP_VAR_SET is set" && exit 1 diff --git a/hack/run-e2e-test.sh b/hack/run-e2e-test.sh index df25b87e6..5a3558e07 100755 --- a/hack/run-e2e-test.sh +++ b/hack/run-e2e-test.sh @@ -8,6 +8,7 @@ KUBECONFIG=${KUBECONFIG:-/root/env/ign/auth/kubeconfig} echo ${SRIOV_CNI_IMAGE} echo ${SRIOV_INFINIBAND_CNI_IMAGE} echo ${OVS_CNI_IMAGE} +echo ${RDMA_CNI_IMAGE} echo ${SRIOV_DEVICE_PLUGIN_IMAGE} echo ${NETWORK_RESOURCES_INJECTOR_IMAGE} echo ${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE}