Skip to content

Commit 3ab1a49

Browse files
committed
build/lib/release: Explicitly use '--platform' in building server images
When we switched to go-runner for building the apiserver, controller-manager, and scheduler server components, we no longer reference the individual architectures in the image names, specifically in the 'FROM' directive of the server image Dockerfiles. As a result, server images for non-amd64 images copy in the go-runner amd64 binary instead of the go-runner that matches that architecture. This commit explicitly sets the '--platform=linux/${arch}' to ensure we're pulling the correct go-runner arch from the manifest list. Before: FROM ${base_image} After: FROM --platform=linux/${arch} ${base_image} Signed-off-by: Stephen Augustus <[email protected]>
1 parent 0921f64 commit 3ab1a49

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

build/common.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ readonly KUBE_CONTAINER_RSYNC_PORT=8730
9393
#
9494
# $1 - server architecture
9595
kube::build::get_docker_wrapped_binaries() {
96-
local arch=$1
9796
local debian_iptables_version=v12.1.2
9897
local go_runner_version=buster-v2.0.0
9998
### If you change any of these lists, please also update DOCKERIZED_BINARIES
@@ -102,7 +101,7 @@ kube::build::get_docker_wrapped_binaries() {
102101
"kube-apiserver,${KUBE_BASE_IMAGE_REGISTRY}/go-runner:${go_runner_version}"
103102
"kube-controller-manager,${KUBE_BASE_IMAGE_REGISTRY}/go-runner:${go_runner_version}"
104103
"kube-scheduler,${KUBE_BASE_IMAGE_REGISTRY}/go-runner:${go_runner_version}"
105-
"kube-proxy,${KUBE_BASE_IMAGE_REGISTRY}/debian-iptables-${arch}:${debian_iptables_version}"
104+
"kube-proxy,${KUBE_BASE_IMAGE_REGISTRY}/debian-iptables:${debian_iptables_version}"
106105
)
107106

108107
echo "${targets[@]}"

build/lib/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ function kube::release::create_docker_images_for_server() {
334334
local images_dir
335335
binary_dir="$1"
336336
arch="$2"
337-
binaries=$(kube::build::get_docker_wrapped_binaries "${arch}")
337+
binaries=$(kube::build::get_docker_wrapped_binaries)
338338
images_dir="${RELEASE_IMAGES}/${arch}"
339339
mkdir -p "${images_dir}"
340340

@@ -375,7 +375,7 @@ function kube::release::create_docker_images_for_server() {
375375
ln "${KUBE_ROOT}/build/nsswitch.conf" "${docker_build_path}/nsswitch.conf"
376376
chmod 0644 "${docker_build_path}/nsswitch.conf"
377377
cat <<EOF > "${docker_file_path}"
378-
FROM ${base_image}
378+
FROM --platform=linux/${arch} ${base_image}
379379
COPY ${binary_name} /usr/local/bin/${binary_name}
380380
EOF
381381
# ensure /etc/nsswitch.conf exists so go's resolver respects /etc/hosts

0 commit comments

Comments
 (0)