From d900a5b646278ee555cf22d5dce3cba45a0d35fd Mon Sep 17 00:00:00 2001 From: Steven Webster Date: Wed, 26 Jan 2022 17:20:41 -0500 Subject: [PATCH] Add bond-cni container network plugin This commit adds the bonding CNI plugin to StarlingX. The bonding CNI plugin allows a container to bond multiple interfaces together to be used in a fail-over or load balancing configuration. https://github.com/k8snetworkplumbingwg/bond-cni Note that this plugin (for now) resides outside of the main containernetwork project, and is still part of the k8s network plumbing working group project. As such, it is required to build this plugin separately. v1.0 of the bond-cni was released in 2018. Since then, 14 commits containing such things as doc clean-ups and bug fixes have been committed. We pick up these additional fixes by clamping down on the latest commit SHA. Testing: - Configure bond interface name (ifName) - Configure miimon value (miimon) - Configure and verify traffic path for modes (mode): - balance-rr (0) - active-backup (1) - balance-xor (2) - broadcast (3) - 802.3ad (4) - balance-tlb (5) - balance-alb (6) - Configure and verify behaviour for fail-over-mac modes (failOverMac): - none (0) - active (1) - follow (2) - Configure linksInContainer: - take lower interfaces existing on host - take lower interfaces existing on container - Links tested: - virtual interfaces - SR-IOV VF interfaces Story: 2009800 Task: 44344 Change-Id: I7bffaa272ffe9eba85c3aa0a26b9c4f61428b640 Signed-off-by: Steven Webster --- centos_iso_image.inc | 1 + centos_pkg_dirs | 1 + centos_tarball-dl.lst | 1 + kubernetes/cni/bond-cni/centos/bond-cni.spec | 73 +++++++++++++++++++ .../cni/bond-cni/centos/build_srpm.data | 7 ++ 5 files changed, 83 insertions(+) create mode 100644 kubernetes/cni/bond-cni/centos/bond-cni.spec create mode 100644 kubernetes/cni/bond-cni/centos/build_srpm.data diff --git a/centos_iso_image.inc b/centos_iso_image.inc index ab020bb01..ae7d9da46 100644 --- a/centos_iso_image.inc +++ b/centos_iso_image.inc @@ -175,6 +175,7 @@ containerd k8s-pod-recovery k8s-cni-cache-cleanup containernetworking-plugins +bond-cni # resource-agents resource-agents diff --git a/centos_pkg_dirs b/centos_pkg_dirs index ccc2ffe3b..087ddb840 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -54,6 +54,7 @@ security/tboot docker/python-docker kubernetes/containerd kubernetes/cni/plugins +kubernetes/cni/bond-cni kubernetes/kubernetes-1.18.1 kubernetes/kubernetes-1.19.13 kubernetes/kubernetes-1.20.9 diff --git a/centos_tarball-dl.lst b/centos_tarball-dl.lst index 42b103471..4f9de2a3c 100644 --- a/centos_tarball-dl.lst +++ b/centos_tarball-dl.lst @@ -90,3 +90,4 @@ inih-b1dbff4b0bd1e1f40d237e21011f6dee0ec2fa69.tar.gz#inih-44#https://github.com/ pf-bb-config-d7d5f1ddd17b4c80e3e0d6ce87660926f58f8585.tar.gz#pf-bb-config-21.6#https://github.com/intel/pf-bb-config/tarball/d7d5f1ddd17b4c80e3e0d6ce87660926f58f8585#https## gpu-operator-1.8.1.tar.gz#gpu-operator-1.8.1#https://github.com/NVIDIA/gpu-operator/archive/v1.8.1.tar.gz##https## containernetworking-plugins-v0.9.1.tar.gz#containernetworking-plugins-v0.9.1#https://github.com/containernetworking/plugins/archive/refs/tags/v0.9.1.tar.gz#https## +bond-cni-bff6422d7089d988dc1548e6abe0543601f6e1c7.tar.gz#bond-cni-bff6422d7089d988dc1548e6abe0543601f6e1c7#https://api.github.com/repos/k8snetworkplumbingwg/bond-cni/tarball/bff6422d7089d988dc1548e6abe0543601f6e1c7#https## diff --git a/kubernetes/cni/bond-cni/centos/bond-cni.spec b/kubernetes/cni/bond-cni/centos/bond-cni.spec new file mode 100644 index 000000000..5a40dedd7 --- /dev/null +++ b/kubernetes/cni/bond-cni/centos/bond-cni.spec @@ -0,0 +1,73 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Wind River Systems, Inc. +# + +# Use the same build parameters as the other CNI plugins from containernetworking-plugins +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; +%endif + +%global provider github +%global provider_tld com +%global project k8snetworkplumbingwg +%global repo bond-cni +# https://github.com/k8snetworkplumbingwg/bond-cni +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%global commit bff6422d7089d988dc1548e6abe0543601f6e1c7 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Name: bond-cni +Version: 1.0 +Release: %{shortcommit}%{?_tis_dist}.%{tis_patch_ver} +Summary: Bond CNI network plugin +License: ASL 2.0 +URL: https://%{provider_prefix} + +Source0: %{repo}-%{commit}.tar.gz +ExclusiveArch: aarch64 %{arm} ppc64le s390x x86_64 %{ix86} + +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang >= 1.13} +Provides: bond-cni = %{version}-%{release} + +%description +The Bond-CNI concerns itself only with providing network connectivity via +bonding of containers and removing any allocated resources when the container +is deleted. + +%prep +%autosetup -n %{repo}-%{commit} + +%build +export ORG_PATH="%{provider}.%{provider_tld}/%{project}" +export REPO_PATH="$ORG_PATH/%{repo}" + +if [ ! -h gopath/src/${REPO_PATH} ]; then + mkdir -p gopath/src/${ORG_PATH} + ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 +fi + +export GOPATH=$(pwd)/gopath +mkdir -p $(pwd)/bin + +echo "Building bond-cni plugin" + +%gobuild -o "${PWD}/bin/bond" "${PWD}/bond/" + +%install +install -d -p %{buildroot}%{_libexecdir}/cni/ +install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + +%files +%license LICENSE +%doc *.md +%dir %{_libexecdir}/cni +%{_libexecdir}/cni/* + +%changelog +* Fri Jan 21 2022 Steven Webster +- Initial package, based on v1.0 + 14 additional commits. diff --git a/kubernetes/cni/bond-cni/centos/build_srpm.data b/kubernetes/cni/bond-cni/centos/build_srpm.data new file mode 100644 index 000000000..775dd0147 --- /dev/null +++ b/kubernetes/cni/bond-cni/centos/build_srpm.data @@ -0,0 +1,7 @@ +VERSION=bff6422d7089d988dc1548e6abe0543601f6e1c7 +TAR_NAME=bond-cni +TAR="${TAR_NAME}-${VERSION}.tar.gz" + +COPY_LIST="${CGCS_BASE}/downloads/${TAR}" + +TIS_PATCH_VER=PKG_GITREVCOUNT