From 2d6629b9dcf979c58902c40adb876582e015fdfd Mon Sep 17 00:00:00 2001 From: Chase Naples Date: Fri, 3 Oct 2025 04:47:49 -0400 Subject: [PATCH] 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 --- GNUmakefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 4e66033be..86f488efd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -477,6 +477,8 @@ copywriteheaders: .PHONY: cni cni: ## Install CNI plugins. Run this as root. + @# Detect architecture: x86_64 -> amd64, aarch64 -> arm64 + $(eval CNI_ARCH := $(shell if [ "$(THIS_ARCH)" = "aarch64" ]; then echo "arm64"; else echo "amd64"; fi)) mkdir -p /opt/cni/bin - curl --fail -LsO "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz" - tar -C /opt/cni/bin -xf cni-plugins-linux-amd64-v1.3.0.tgz + curl --fail -LsO "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-$(CNI_ARCH)-v1.3.0.tgz" + tar -C /opt/cni/bin -xf cni-plugins-linux-$(CNI_ARCH)-v1.3.0.tgz