From d4c56d145fcbeacdbeb13f50bac0e97eb01049db Mon Sep 17 00:00:00 2001 From: Steven Webster Date: Thu, 7 Apr 2022 20:13:38 -0400 Subject: [PATCH] Enable bond-cni to build with golang 1.17 This commit fixes an issue that was seen if golang 1.17 was chosen as the toolchain to build the CNI package. The go 1.17.5 build complains that the following vendored modules should be explicitly required in the go.mod file: github.com/coreos/go-iptables v0.6.0 github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e If these are added to the go.mod file, a further complaint is given that it no longer matches the information in vendor/modules.txt The patch files were generated by running go mod tidy for the go.mod file, and go mod vendor for the vendor/modules.txt. Since the bond-cni uses go 1.17 in the go directive of its go.mod file, this commit locks down on this version to attempt to prevent other issues from arising from new or other golang versions. Testing: - CentOS build - Debian build - Spot check of bond-cni functionality on CentOS Closes-Bug: 1966728 Signed-off-by: Steven Webster Change-Id: I14638165db48cda9b89dd666b0c8b7c0a4e8e380 --- kubernetes/cni/bond-cni/centos/bond-cni.spec | 6 +- .../cni/bond-cni/centos/build_srpm.data | 2 +- ...-explicit-vendor-module-dependencies.patch | 68 +++++++++++++++++++ .../cni/bond-cni/debian/deb_folder/control | 2 +- ...-explicit-vendor-module-dependencies.patch | 68 +++++++++++++++++++ .../bond-cni/debian/deb_folder/patches/series | 1 + .../cni/bond-cni/debian/deb_folder/rules | 1 + 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 kubernetes/cni/bond-cni/centos/files/0001-Add-explicit-vendor-module-dependencies.patch create mode 100644 kubernetes/cni/bond-cni/debian/deb_folder/patches/0001-Add-explicit-vendor-module-dependencies.patch create mode 100644 kubernetes/cni/bond-cni/debian/deb_folder/patches/series diff --git a/kubernetes/cni/bond-cni/centos/bond-cni.spec b/kubernetes/cni/bond-cni/centos/bond-cni.spec index 5a40dedd7..3c45c9c42 100644 --- a/kubernetes/cni/bond-cni/centos/bond-cni.spec +++ b/kubernetes/cni/bond-cni/centos/bond-cni.spec @@ -26,9 +26,10 @@ License: ASL 2.0 URL: https://%{provider_prefix} Source0: %{repo}-%{commit}.tar.gz +Patch1: 0001-Add-explicit-vendor-module-dependencies.patch ExclusiveArch: aarch64 %{arm} ppc64le s390x x86_64 %{ix86} -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang >= 1.13} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang = 1.17.5} Provides: bond-cni = %{version}-%{release} %description @@ -37,7 +38,8 @@ bonding of containers and removing any allocated resources when the container is deleted. %prep -%autosetup -n %{repo}-%{commit} +%setup -n %{repo}-%{commit} +%patch1 -p1 %build export ORG_PATH="%{provider}.%{provider_tld}/%{project}" diff --git a/kubernetes/cni/bond-cni/centos/build_srpm.data b/kubernetes/cni/bond-cni/centos/build_srpm.data index 775dd0147..390b3dc00 100644 --- a/kubernetes/cni/bond-cni/centos/build_srpm.data +++ b/kubernetes/cni/bond-cni/centos/build_srpm.data @@ -2,6 +2,6 @@ VERSION=bff6422d7089d988dc1548e6abe0543601f6e1c7 TAR_NAME=bond-cni TAR="${TAR_NAME}-${VERSION}.tar.gz" -COPY_LIST="${CGCS_BASE}/downloads/${TAR}" +COPY_LIST="${CGCS_BASE}/downloads/${TAR} ${FILES_BASE}/*" TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/kubernetes/cni/bond-cni/centos/files/0001-Add-explicit-vendor-module-dependencies.patch b/kubernetes/cni/bond-cni/centos/files/0001-Add-explicit-vendor-module-dependencies.patch new file mode 100644 index 000000000..105b8ecbf --- /dev/null +++ b/kubernetes/cni/bond-cni/centos/files/0001-Add-explicit-vendor-module-dependencies.patch @@ -0,0 +1,68 @@ +From 76ac4271502d6356f5150f6047d9dc05eb2470bd Mon Sep 17 00:00:00 2001 +From: Steven Webster +Date: Fri, 8 Apr 2022 16:01:58 -0400 +Subject: [PATCH] Add explicit vendor module dependencies + +Signed-off-by: Steven Webster +--- + go.mod | 6 ++++++ + vendor/modules.txt | 11 +++++++---- + 2 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/go.mod b/go.mod +index c334299..385a70f 100644 +--- a/go.mod ++++ b/go.mod +@@ -8,3 +8,9 @@ require ( + github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 + github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 + ) ++ ++require ( ++ github.com/coreos/go-iptables v0.6.0 // indirect ++ github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 // indirect ++ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect ++) +diff --git a/vendor/modules.txt b/vendor/modules.txt +index ac4b3f5..d684960 100644 +--- a/vendor/modules.txt ++++ b/vendor/modules.txt +@@ -1,5 +1,5 @@ + # github.com/containernetworking/cni v1.0.1 +-## explicit ++## explicit; go 1.14 + github.com/containernetworking/cni/pkg/invoke + github.com/containernetworking/cni/pkg/skel + github.com/containernetworking/cni/pkg/types +@@ -11,22 +11,25 @@ github.com/containernetworking/cni/pkg/types/internal + github.com/containernetworking/cni/pkg/utils + github.com/containernetworking/cni/pkg/version + # github.com/containernetworking/plugins v1.0.1 +-## explicit ++## explicit; go 1.16 + github.com/containernetworking/plugins/pkg/ip + github.com/containernetworking/plugins/pkg/ipam + github.com/containernetworking/plugins/pkg/ns + github.com/containernetworking/plugins/pkg/utils/sysctl + # github.com/coreos/go-iptables v0.6.0 ++## explicit; go 1.16 + github.com/coreos/go-iptables/iptables + # github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 ++## explicit + github.com/safchain/ethtool + # github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 +-## explicit ++## explicit; go 1.12 + github.com/vishvananda/netlink + github.com/vishvananda/netlink/nl + # github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 +-## explicit ++## explicit; go 1.12 + github.com/vishvananda/netns + # golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e ++## explicit; go 1.17 + golang.org/x/sys/internal/unsafeheader + golang.org/x/sys/unix +-- +2.29.2 + diff --git a/kubernetes/cni/bond-cni/debian/deb_folder/control b/kubernetes/cni/bond-cni/debian/deb_folder/control index c4f4a195a..6295a19ef 100644 --- a/kubernetes/cni/bond-cni/debian/deb_folder/control +++ b/kubernetes/cni/bond-cni/debian/deb_folder/control @@ -6,7 +6,7 @@ Standards-Version: 4.6.0 Homepage: https://www.starlingx.io Build-Depends: debhelper-compat (= 13), dh-golang, - golang-any, + golang-1.17, golang-github-appc-cni-dev, golang-github-containernetworking-plugins-dev, golang-github-vishvananda-netlink-dev, diff --git a/kubernetes/cni/bond-cni/debian/deb_folder/patches/0001-Add-explicit-vendor-module-dependencies.patch b/kubernetes/cni/bond-cni/debian/deb_folder/patches/0001-Add-explicit-vendor-module-dependencies.patch new file mode 100644 index 000000000..105b8ecbf --- /dev/null +++ b/kubernetes/cni/bond-cni/debian/deb_folder/patches/0001-Add-explicit-vendor-module-dependencies.patch @@ -0,0 +1,68 @@ +From 76ac4271502d6356f5150f6047d9dc05eb2470bd Mon Sep 17 00:00:00 2001 +From: Steven Webster +Date: Fri, 8 Apr 2022 16:01:58 -0400 +Subject: [PATCH] Add explicit vendor module dependencies + +Signed-off-by: Steven Webster +--- + go.mod | 6 ++++++ + vendor/modules.txt | 11 +++++++---- + 2 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/go.mod b/go.mod +index c334299..385a70f 100644 +--- a/go.mod ++++ b/go.mod +@@ -8,3 +8,9 @@ require ( + github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 + github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 + ) ++ ++require ( ++ github.com/coreos/go-iptables v0.6.0 // indirect ++ github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 // indirect ++ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect ++) +diff --git a/vendor/modules.txt b/vendor/modules.txt +index ac4b3f5..d684960 100644 +--- a/vendor/modules.txt ++++ b/vendor/modules.txt +@@ -1,5 +1,5 @@ + # github.com/containernetworking/cni v1.0.1 +-## explicit ++## explicit; go 1.14 + github.com/containernetworking/cni/pkg/invoke + github.com/containernetworking/cni/pkg/skel + github.com/containernetworking/cni/pkg/types +@@ -11,22 +11,25 @@ github.com/containernetworking/cni/pkg/types/internal + github.com/containernetworking/cni/pkg/utils + github.com/containernetworking/cni/pkg/version + # github.com/containernetworking/plugins v1.0.1 +-## explicit ++## explicit; go 1.16 + github.com/containernetworking/plugins/pkg/ip + github.com/containernetworking/plugins/pkg/ipam + github.com/containernetworking/plugins/pkg/ns + github.com/containernetworking/plugins/pkg/utils/sysctl + # github.com/coreos/go-iptables v0.6.0 ++## explicit; go 1.16 + github.com/coreos/go-iptables/iptables + # github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 ++## explicit + github.com/safchain/ethtool + # github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 +-## explicit ++## explicit; go 1.12 + github.com/vishvananda/netlink + github.com/vishvananda/netlink/nl + # github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 +-## explicit ++## explicit; go 1.12 + github.com/vishvananda/netns + # golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e ++## explicit; go 1.17 + golang.org/x/sys/internal/unsafeheader + golang.org/x/sys/unix +-- +2.29.2 + diff --git a/kubernetes/cni/bond-cni/debian/deb_folder/patches/series b/kubernetes/cni/bond-cni/debian/deb_folder/patches/series new file mode 100644 index 000000000..15fdbe060 --- /dev/null +++ b/kubernetes/cni/bond-cni/debian/deb_folder/patches/series @@ -0,0 +1 @@ +0001-Add-explicit-vendor-module-dependencies.patch diff --git a/kubernetes/cni/bond-cni/debian/deb_folder/rules b/kubernetes/cni/bond-cni/debian/deb_folder/rules index 37c344d2b..f6af93e1e 100644 --- a/kubernetes/cni/bond-cni/debian/deb_folder/rules +++ b/kubernetes/cni/bond-cni/debian/deb_folder/rules @@ -1,5 +1,6 @@ #!/usr/bin/make -f +export PATH := /usr/lib/go-1.17/bin:$(PATH) export DH_VERBOSE = 1 export DH_GOLANG_GO_GENERATE := 1