Signed-off-by: Ruoqing He <ruoqing@isrc.iscas.ac.cn> (cherry picked from commit ac3c2af59e98e6327d0efeab5e0fd6d352f7b0e9)
187 lines
6.5 KiB
Diff
187 lines
6.5 KiB
Diff
From 4f3aea675fd7652bab6dc68bf919dedc0069d286 Mon Sep 17 00:00:00 2001
|
|
From: Ruoqing He <ruoqing@isrc.iscas.ac.cn>
|
|
Date: Wed, 3 Jul 2024 22:31:26 +0800
|
|
Subject: [PATCH 1/1] Add riscv64 support for v1.29.1 kubernetes
|
|
|
|
Signed-off-by: Ruoqing He <ruoqing@isrc.iscas.ac.cn>
|
|
---
|
|
build/pause/Makefile | 3 ++-
|
|
cluster/get-kube-binaries.sh | 5 ++++-
|
|
cluster/images/etcd/Makefile | 5 ++++-
|
|
hack/lib/golang.sh | 12 ++++++++++--
|
|
hack/lib/util.sh | 5 ++++-
|
|
hack/local-up-cluster.sh | 6 +++++-
|
|
test/images/image-util.sh | 2 +-
|
|
7 files changed, 30 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/build/pause/Makefile b/build/pause/Makefile
|
|
index 1c49bf2f..de27a9f2 100644
|
|
--- a/build/pause/Makefile
|
|
+++ b/build/pause/Makefile
|
|
@@ -32,7 +32,7 @@ OSVERSION ?= 1809 ltsc2022
|
|
OUTPUT_TYPE ?= docker
|
|
|
|
ALL_OS = linux windows
|
|
-ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x
|
|
+ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64
|
|
ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))
|
|
ALL_ARCH.windows = amd64
|
|
ALL_OSVERSIONS.windows := 1809 ltsc2022
|
|
@@ -66,6 +66,7 @@ TRIPLE.linux-arm := arm-linux-gnueabihf
|
|
TRIPLE.linux-arm64 := aarch64-linux-gnu
|
|
TRIPLE.linux-ppc64le := powerpc64le-linux-gnu
|
|
TRIPLE.linux-s390x := s390x-linux-gnu
|
|
+TRIPLE.linux-riscv64 := riscv64-linux-gnu
|
|
TRIPLE := ${TRIPLE.${OS}-${ARCH}}
|
|
BASE.linux := scratch
|
|
# Source for windows pause image base is located at https://github.com/microsoft/windows-pause-image-base
|
|
diff --git a/cluster/get-kube-binaries.sh b/cluster/get-kube-binaries.sh
|
|
index 13b916fd..e81e30a2 100755
|
|
--- a/cluster/get-kube-binaries.sh
|
|
+++ b/cluster/get-kube-binaries.sh
|
|
@@ -120,9 +120,12 @@ function detect_client_info() {
|
|
s390x*)
|
|
CLIENT_ARCH="s390x"
|
|
;;
|
|
+ riscv64*)
|
|
+ CLIENT_ARCH="riscv64"
|
|
+ ;;
|
|
*)
|
|
echo "Unknown, unsupported architecture (${machine})." >&2
|
|
- echo "Supported architectures x86_64, i686, arm, arm64, ppc64le, s390x." >&2
|
|
+ echo "Supported architectures x86_64, i686, arm, arm64, ppc64le, s390x, riscv64." >&2
|
|
echo "Bailing out." >&2
|
|
exit 3
|
|
;;
|
|
diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile
|
|
index 85e3737a..c9ae52e0 100644
|
|
--- a/cluster/images/etcd/Makefile
|
|
+++ b/cluster/images/etcd/Makefile
|
|
@@ -51,7 +51,7 @@ OSVERSION ?= 1809
|
|
OUTPUT_TYPE ?= docker
|
|
|
|
ALL_OS = linux windows
|
|
-ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x
|
|
+ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64
|
|
ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))
|
|
ALL_ARCH.windows = amd64
|
|
ALL_OSVERSIONS.windows := 1809 ltsc2022
|
|
@@ -106,6 +106,9 @@ endif
|
|
ifeq ($(ARCH),s390x)
|
|
BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bookworm-v1.0.0
|
|
endif
|
|
+ifeq ($(ARCH),riscv64)
|
|
+ BASEIMAGE?=registry.k8s.io/build-image/debian-base-riscv64:bookworm-v1.0.0
|
|
+endif
|
|
|
|
BASE.windows = mcr.microsoft.com/windows/nanoserver
|
|
|
|
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
|
|
index f3466ff7..e01db83e 100755
|
|
--- a/hack/lib/golang.sh
|
|
+++ b/hack/lib/golang.sh
|
|
@@ -27,6 +27,7 @@ readonly KUBE_SUPPORTED_SERVER_PLATFORMS=(
|
|
linux/arm64
|
|
linux/s390x
|
|
linux/ppc64le
|
|
+ linux/riscv64
|
|
)
|
|
|
|
# The node platforms we build for
|
|
@@ -35,6 +36,7 @@ readonly KUBE_SUPPORTED_NODE_PLATFORMS=(
|
|
linux/arm64
|
|
linux/s390x
|
|
linux/ppc64le
|
|
+ linux/riscv64
|
|
windows/amd64
|
|
)
|
|
|
|
@@ -47,6 +49,7 @@ readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=(
|
|
linux/arm64
|
|
linux/s390x
|
|
linux/ppc64le
|
|
+ linux/riscv64
|
|
darwin/amd64
|
|
darwin/arm64
|
|
windows/amd64
|
|
@@ -61,6 +64,7 @@ readonly KUBE_SUPPORTED_TEST_PLATFORMS=(
|
|
linux/arm64
|
|
linux/s390x
|
|
linux/ppc64le
|
|
+ linux/riscv64
|
|
darwin/amd64
|
|
darwin/arm64
|
|
windows/amd64
|
|
@@ -210,8 +214,8 @@ kube::golang::setup_platforms() {
|
|
|
|
elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then
|
|
host_arch=$(kube::util::host_arch)
|
|
- if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" ]]; then
|
|
- # on any platform other than amd64, arm64, ppc64le and s390x, we just default to amd64
|
|
+ if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" && "${host_arch}" != "riscv64" ]]; then
|
|
+ # on any platform other than amd64, arm64, ppc64le, s390x and riscv64, we just default to amd64
|
|
host_arch="amd64"
|
|
fi
|
|
KUBE_SERVER_PLATFORMS=("linux/${host_arch}")
|
|
@@ -435,6 +439,10 @@ kube::golang::set_platform_envs() {
|
|
export CGO_ENABLED=1
|
|
export CC=${KUBE_LINUX_S390X_CC:-s390x-linux-gnu-gcc}
|
|
;;
|
|
+ "linux/riscv64")
|
|
+ export CGO_ENABLED=1
|
|
+ export CC=${KUBE_LINUX_RISCV64_CC:-riscv64-linux-gnu-gcc}
|
|
+ ;;
|
|
esac
|
|
fi
|
|
|
|
diff --git a/hack/lib/util.sh b/hack/lib/util.sh
|
|
index 70568f76..0b65b148 100755
|
|
--- a/hack/lib/util.sh
|
|
+++ b/hack/lib/util.sh
|
|
@@ -185,8 +185,11 @@ kube::util::host_arch() {
|
|
ppc64le*)
|
|
host_arch=ppc64le
|
|
;;
|
|
+ riscv64*)
|
|
+ host_arch=riscv64
|
|
+ ;;
|
|
*)
|
|
- kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le."
|
|
+ kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x, ppc64le or riscv64."
|
|
exit 1
|
|
;;
|
|
esac
|
|
diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh
|
|
index 83bdd694..9319c094 100755
|
|
--- a/hack/local-up-cluster.sh
|
|
+++ b/hack/local-up-cluster.sh
|
|
@@ -293,7 +293,11 @@ function detect_arch {
|
|
host_arch=ppc64le
|
|
;;
|
|
*)
|
|
- echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le." >&2
|
|
+ riscv64*)
|
|
+ host_arch=riscv64
|
|
+ ;;
|
|
+ *)
|
|
+ echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x, ppc64le or riscv64." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
diff --git a/test/images/image-util.sh b/test/images/image-util.sh
|
|
index 9b729b34..b6940f73 100755
|
|
--- a/test/images/image-util.sh
|
|
+++ b/test/images/image-util.sh
|
|
@@ -34,7 +34,7 @@ source "${KUBE_ROOT}/hack/lib/logging.sh"
|
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
|
|
|
# Mapping of go ARCH to actual architectures shipped part of multiarch/qemu-user-static project
|
|
-declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" )
|
|
+declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" ["riscv64"]="riscv64")
|
|
|
|
# NOTE(claudiub): In the test image build jobs, this script is not being run in a git repository,
|
|
# which would cause git log to fail. Instead, we can use the GIT_COMMIT_ID set in cloudbuild.yaml.
|
|
--
|
|
2.45.2
|
|
|