From f439d47b4c5c06999044fc9f67c4d01a9137a47a 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 | 17 +++++++++++++++++ controllers/sriovoperatorconfig_controller.go | 1 + controllers/suite_test.go | 2 ++ deploy/operator.yaml | 2 ++ .../sriov-network-operator-chart/README.md | 1 + .../templates/operator.yaml | 2 ++ .../sriov-network-operator-chart/values.yaml | 1 + hack/env.sh | 4 ++++ hack/release/chart-update.sh | 2 ++ hack/run-e2e-test.sh | 1 + 10 files changed, 33 insertions(+) diff --git a/bindata/manifests/daemon/daemonset.yaml b/bindata/manifests/daemon/daemonset.yaml index b5126ae28..1c3d7d618 100644 --- a/bindata/manifests/daemon/daemonset.yaml +++ b/bindata/manifests/daemon/daemonset.yaml @@ -92,6 +92,23 @@ 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 + - name: os-release + mountPath: /host/etc/os-release + readOnly: true + {{- end }} {{- if .UsedSystemdMode}} - name: sriov-service-copy image: {{.Image}} diff --git a/controllers/sriovoperatorconfig_controller.go b/controllers/sriovoperatorconfig_controller.go index 6a5088a95..11cfdfc36 100644 --- a/controllers/sriovoperatorconfig_controller.go +++ b/controllers/sriovoperatorconfig_controller.go @@ -178,6 +178,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 b830e2fc2..3951d1b60 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -115,6 +115,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 18eeb434c..4236db22e 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -58,6 +58,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-chart/README.md b/deployment/sriov-network-operator-chart/README.md index 75f681ee9..cbc8dee3d 100644 --- a/deployment/sriov-network-operator-chart/README.md +++ b/deployment/sriov-network-operator-chart/README.md @@ -139,6 +139,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-chart/templates/operator.yaml b/deployment/sriov-network-operator-chart/templates/operator.yaml index 9eebf39cf..cd4e08192 100644 --- a/deployment/sriov-network-operator-chart/templates/operator.yaml +++ b/deployment/sriov-network-operator-chart/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-chart/values.yaml b/deployment/sriov-network-operator-chart/values.yaml index 8637f0bfb..73c9aeb9f 100644 --- a/deployment/sriov-network-operator-chart/values.yaml +++ b/deployment/sriov-network-operator-chart/values.yaml @@ -103,6 +103,7 @@ images: sriovCni: ghcr.io/k8snetworkplumbingwg/sriov-cni ibSriovCni: ghcr.io/k8snetworkplumbingwg/ib-sriov-cni ovsCni: ghcr.io/k8snetworkplumbingwg/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 c41c0aad2..28e0007e7 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-ghcr.io/k8snetworkplumbingwg/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} @@ -13,6 +15,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:-} METRICS_EXPORTER_KUBE_RBAC_PROXY_IMAGE=${METRICS_EXPORTER_KUBE_RBAC_PROXY_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 diff --git a/hack/release/chart-update.sh b/hack/release/chart-update.sh index 282521020..ec4618175 100755 --- a/hack/release/chart-update.sh +++ b/hack/release/chart-update.sh @@ -45,6 +45,7 @@ OPERATOR_TAG=${GITHUB_TAG} IB_SRIOV_CNI_TAG=$(get_latest_github_tag k8snetworkplumbingwg ib-sriov-cni) SRIOV_CNI_TAG=$(get_latest_github_tag k8snetworkplumbingwg sriov-cni) OVS_CNI_TAG=$(get_latest_github_tag k8snetworkplumbingwg ovs-cni) +RDMA_CNI_TAG=$(get_latest_github_tag k8snetworkplumbingwg rdma-cni) NETWORK_RESOURCE_INJECTOR_TAG=$(get_latest_github_tag k8snetworkplumbingwg network-resources-injector) SRIOV_DEVICE_PLUGIN_TAG=$(get_latest_github_tag k8snetworkplumbingwg sriov-network-device-plugin) METRICS_EXPORTER_TAG=$(get_latest_github_tag k8snetworkplumbingwg sriov-network-metrics-exporter) @@ -61,6 +62,7 @@ $YQ_CMD -i ".images.webhook = \"ghcr.io/${OPERATOR_REPO}/sriov-network-operator- $YQ_CMD -i ".images.sriovCni = \"ghcr.io/k8snetworkplumbingwg/sriov-cni:${SRIOV_CNI_TAG}\"" ${HELM_VALUES} $YQ_CMD -i ".images.ibSriovCni = \"ghcr.io/k8snetworkplumbingwg/ib-sriov-cni:${IB_SRIOV_CNI_TAG}\"" ${HELM_VALUES} $YQ_CMD -i ".images.ovsCni = \"ghcr.io/k8snetworkplumbingwg/ovs-cni-plugin:${OVS_CNI_TAG}\"" ${HELM_VALUES} +$YQ_CMD -i ".images.rdmaCni = \"ghcr.io/k8snetworkplumbingwg/rdma-cni:${RDMA_CNI_TAG}\"" ${HELM_VALUES} $YQ_CMD -i ".images.sriovDevicePlugin = \"ghcr.io/k8snetworkplumbingwg/sriov-network-device-plugin:${SRIOV_DEVICE_PLUGIN_TAG}\"" ${HELM_VALUES} $YQ_CMD -i ".images.resourcesInjector = \"ghcr.io/k8snetworkplumbingwg/network-resources-injector:${NETWORK_RESOURCE_INJECTOR_TAG}\"" ${HELM_VALUES} $YQ_CMD -i ".images.metricsExporter = \"ghcr.io/k8snetworkplumbingwg/sriov-network-metrics-exporter:${METRICS_EXPORTER_TAG}\"" ${HELM_VALUES} diff --git a/hack/run-e2e-test.sh b/hack/run-e2e-test.sh index c7d4fea50..a5bb69c05 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}