Skip to content

Commit 2d6629b

Browse files
authored
build: add architecture detection to CNI makefile target (#26877)
The 'cni' make target was hardcoded to download amd64 CNI plugins, which prevented users on arm64/aarch64 systems from using this target. This change adds automatic architecture detection that maps the system architecture (from uname -m) to the appropriate CNI plugin architecture: - x86_64 -> amd64 (existing behavior) - aarch64 -> arm64 (new support) The implementation uses the existing THIS_ARCH variable already defined in the Makefile, ensuring consistency with other build targets. Fixes #26864
1 parent c723385 commit 2d6629b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

GNUmakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ copywriteheaders:
477477

478478
.PHONY: cni
479479
cni: ## Install CNI plugins. Run this as root.
480+
@# Detect architecture: x86_64 -> amd64, aarch64 -> arm64
481+
$(eval CNI_ARCH := $(shell if [ "$(THIS_ARCH)" = "aarch64" ]; then echo "arm64"; else echo "amd64"; fi))
480482
mkdir -p /opt/cni/bin
481-
curl --fail -LsO "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz"
482-
tar -C /opt/cni/bin -xf cni-plugins-linux-amd64-v1.3.0.tgz
483+
curl --fail -LsO "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-$(CNI_ARCH)-v1.3.0.tgz"
484+
tar -C /opt/cni/bin -xf cni-plugins-linux-$(CNI_ARCH)-v1.3.0.tgz

0 commit comments

Comments
 (0)