mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
images: Adds linux/ prefix to BASEIMAGE entries
Windows images will require other base images, and thus, we will need to explicitly specify the OS type a base image is for in order to avoid confusion or errors.
This commit is contained in:
parent
22a5fbcfa9
commit
efcdb929de
@ -1,5 +1,5 @@
|
|||||||
amd64=alpine:3.6
|
linux/amd64=alpine:3.6
|
||||||
arm=arm32v6/alpine:3.6
|
linux/arm=arm32v6/alpine:3.6
|
||||||
arm64=arm64v8/alpine:3.6
|
linux/arm64=arm64v8/alpine:3.6
|
||||||
ppc64le=ppc64le/alpine:3.6
|
linux/ppc64le=ppc64le/alpine:3.6
|
||||||
s390x=s390x/alpine:3.6
|
linux/s390x=s390x/alpine:3.6
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
amd64=alpine:3.8
|
linux/amd64=alpine:3.8
|
||||||
arm=arm32v6/alpine:3.8
|
linux/arm=arm32v6/alpine:3.8
|
||||||
arm64=arm64v8/alpine:3.8
|
linux/arm64=arm64v8/alpine:3.8
|
||||||
ppc64le=ppc64le/alpine:3.8
|
linux/ppc64le=ppc64le/alpine:3.8
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
amd64=nvidia/cuda:10.0-devel-ubuntu18.04
|
linux/amd64=nvidia/cuda:10.0-devel-ubuntu18.04
|
||||||
ppc64le=nvidia/cuda-ppc64le:10.0-devel-ubuntu18.04
|
linux/ppc64le=nvidia/cuda-ppc64le:10.0-devel-ubuntu18.04
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=nginx:1.15-alpine
|
linux/amd64=nginx:1.15-alpine
|
||||||
arm=arm32v6/nginx:1.15-alpine
|
linux/arm=arm32v6/nginx:1.15-alpine
|
||||||
arm64=arm64v8/nginx:1.15-alpine
|
linux/arm64=arm64v8/nginx:1.15-alpine
|
||||||
ppc64le=ppc64le/nginx:1.15-alpine
|
linux/ppc64le=ppc64le/nginx:1.15-alpine
|
||||||
s390x=s390x/nginx:1.15-alpine
|
linux/s390x=s390x/nginx:1.15-alpine
|
||||||
|
@ -29,15 +29,16 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
|
|||||||
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" )
|
||||||
|
|
||||||
# Returns list of all supported architectures from BASEIMAGE file
|
# Returns list of all supported architectures from BASEIMAGE file
|
||||||
listArchs() {
|
listOsArchs() {
|
||||||
image=$1
|
image=$1
|
||||||
cut -d "=" -f 1 "${image}"/BASEIMAGE
|
cut -d "=" -f 1 "${image}"/BASEIMAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns baseimage need to used in Dockerfile for any given architecture
|
# Returns baseimage need to used in Dockerfile for any given architecture
|
||||||
getBaseImage() {
|
getBaseImage() {
|
||||||
arch=$1
|
os_name=$1
|
||||||
grep "${arch}=" BASEIMAGE | cut -d= -f2
|
arch=$2
|
||||||
|
grep "${os_name}/${arch}=" BASEIMAGE | cut -d= -f2
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function will build test image for all the architectures
|
# This function will build test image for all the architectures
|
||||||
@ -47,15 +48,24 @@ getBaseImage() {
|
|||||||
build() {
|
build() {
|
||||||
image=$1
|
image=$1
|
||||||
if [[ -f ${image}/BASEIMAGE ]]; then
|
if [[ -f ${image}/BASEIMAGE ]]; then
|
||||||
archs=$(listArchs "$image")
|
os_archs=$(listOsArchs "$image")
|
||||||
else
|
else
|
||||||
archs=${!QEMUARCHS[*]}
|
# prepend linux/ to the QEMUARCHS items.
|
||||||
|
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::util::ensure-gnu-sed
|
kube::util::ensure-gnu-sed
|
||||||
|
|
||||||
for arch in ${archs}; do
|
for os_arch in ${os_archs}; do
|
||||||
echo "Building image for ${image} ARCH: ${arch}..."
|
if [[ $os_arch =~ .*/.* ]]; then
|
||||||
|
os_name=$(echo "$os_arch" | cut -d "/" -f 1)
|
||||||
|
arch=$(echo "$os_arch" | cut -d "/" -f 2)
|
||||||
|
else
|
||||||
|
echo "The BASEIMAGE file for the ${image} image is not properly formatted. Expected entries to start with 'os/arch', found '${os_arch}' instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building image for ${image} OS/ARCH: ${os_arch}..."
|
||||||
|
|
||||||
# Create a temporary directory for every architecture and copy the image content
|
# Create a temporary directory for every architecture and copy the image content
|
||||||
# and build the image from temporary directory
|
# and build the image from temporary directory
|
||||||
@ -74,7 +84,7 @@ build() {
|
|||||||
TAG=$(<VERSION)
|
TAG=$(<VERSION)
|
||||||
|
|
||||||
if [[ -f BASEIMAGE ]]; then
|
if [[ -f BASEIMAGE ]]; then
|
||||||
BASEIMAGE=$(getBaseImage "${arch}")
|
BASEIMAGE=$(getBaseImage "${os_name}" "${arch}")
|
||||||
${SED} -i "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
|
${SED} -i "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
|
||||||
${SED} -i "s|BASEARCH|${arch}|g" Dockerfile
|
${SED} -i "s|BASEARCH|${arch}|g" Dockerfile
|
||||||
fi
|
fi
|
||||||
@ -121,11 +131,20 @@ push() {
|
|||||||
docker_version_check
|
docker_version_check
|
||||||
TAG=$(<"${image}"/VERSION)
|
TAG=$(<"${image}"/VERSION)
|
||||||
if [[ -f ${image}/BASEIMAGE ]]; then
|
if [[ -f ${image}/BASEIMAGE ]]; then
|
||||||
archs=$(listArchs "$image")
|
os_archs=$(listOsArchs "$image")
|
||||||
else
|
else
|
||||||
archs=${!QEMUARCHS[*]}
|
# prepend linux/ to the QEMUARCHS items.
|
||||||
|
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
|
||||||
fi
|
fi
|
||||||
for arch in ${archs}; do
|
for os_arch in ${os_archs}; do
|
||||||
|
if [[ $os_arch =~ .*/.* ]]; then
|
||||||
|
os_name=$(echo "$os_arch" | cut -d "/" -f 1)
|
||||||
|
arch=$(echo "$os_arch" | cut -d "/" -f 2)
|
||||||
|
else
|
||||||
|
echo "The BASEIMAGE file for the ${image} image is not properly formatted. Expected entries to start with 'os/arch', found '${os_arch}' instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
docker push "${REGISTRY}/${image}-${arch}:${TAG}"
|
docker push "${REGISTRY}/${image}-${arch}:${TAG}"
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -135,10 +154,17 @@ push() {
|
|||||||
export DOCKER_CLI_EXPERIMENTAL="enabled"
|
export DOCKER_CLI_EXPERIMENTAL="enabled"
|
||||||
# reset manifest list; needed in case multiple images are being built / pushed.
|
# reset manifest list; needed in case multiple images are being built / pushed.
|
||||||
manifest=()
|
manifest=()
|
||||||
# Make archs list into image manifest. Eg: 'amd64 ppc64le' to '${REGISTRY}/${image}-amd64:${TAG} ${REGISTRY}/${image}-ppc64le:${TAG}'
|
# Make os_archs list into image manifest. Eg: 'linux/amd64 linux/ppc64le' to '${REGISTRY}/${image}-amd64:${TAG} ${REGISTRY}/${image}-ppc64le:${TAG}'
|
||||||
while IFS='' read -r line; do manifest+=("$line"); done < <(echo "$archs" | ${SED} -e "s~[^ ]*~$REGISTRY\/$image\-&:$TAG~g")
|
while IFS='' read -r line; do manifest+=("$line"); done < <(echo "$os_archs" | ${SED} "s~linux\/~~" | ${SED} -e "s~[^ ]*~$REGISTRY\/$image\-&:$TAG~g")
|
||||||
docker manifest create --amend "${REGISTRY}/${image}:${TAG}" "${manifest[@]}"
|
docker manifest create --amend "${REGISTRY}/${image}:${TAG}" "${manifest[@]}"
|
||||||
for arch in ${archs}; do
|
for os_arch in ${os_archs}; do
|
||||||
|
if [[ $os_arch =~ .*/.* ]]; then
|
||||||
|
os_name=$(echo "$os_arch" | cut -d "/" -f 1)
|
||||||
|
arch=$(echo "$os_arch" | cut -d "/" -f 2)
|
||||||
|
else
|
||||||
|
echo "The BASEIMAGE file for the ${image} image is not properly formatted. Expected entries to start with 'os/arch', found '${os_arch}' instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
docker manifest annotate --arch "${arch}" "${REGISTRY}/${image}:${TAG}" "${REGISTRY}/${image}-${arch}:${TAG}"
|
docker manifest annotate --arch "${arch}" "${REGISTRY}/${image}:${TAG}" "${REGISTRY}/${image}-${arch}:${TAG}"
|
||||||
done
|
done
|
||||||
docker manifest push --purge "${REGISTRY}/${image}:${TAG}"
|
docker manifest push --purge "${REGISTRY}/${image}:${TAG}"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
amd64=alpine:3.6
|
linux/amd64=alpine:3.6
|
||||||
arm=arm32v6/alpine:3.6
|
linux/arm=arm32v6/alpine:3.6
|
||||||
arm64=arm64v8/alpine:3.6
|
linux/arm64=arm64v8/alpine:3.6
|
||||||
ppc64le=ppc64le/alpine:3.6
|
linux/ppc64le=ppc64le/alpine:3.6
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=debian:jessie
|
linux/amd64=debian:jessie
|
||||||
arm=arm32v7/debian:jessie
|
linux/arm=arm32v7/debian:jessie
|
||||||
arm64=arm64v8/debian:jessie
|
linux/arm64=arm64v8/debian:jessie
|
||||||
ppc64le=ppc64le/debian:jessie
|
linux/ppc64le=ppc64le/debian:jessie
|
||||||
s390x=s390x/debian:jessie
|
linux/s390x=s390x/debian:jessie
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
|
linux/amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
|
||||||
arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
|
linux/arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
|
||||||
arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
|
linux/arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
|
||||||
ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
|
linux/ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
|
||||||
s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
|
linux/s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
|
linux/amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
|
||||||
arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
|
linux/arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
|
||||||
arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
|
linux/arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
|
||||||
ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
|
linux/ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
|
||||||
s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
|
linux/s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=debian:stretch-slim
|
linux/amd64=debian:stretch-slim
|
||||||
arm64=arm64v8/debian:stretch-slim
|
linux/arm64=arm64v8/debian:stretch-slim
|
||||||
ppc64le=ppc64le/debian:stretch-slim
|
linux/ppc64le=ppc64le/debian:stretch-slim
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=debian:stretch-slim
|
linux/amd64=debian:stretch-slim
|
||||||
arm64=arm64v8/debian:stretch-slim
|
linux/arm64=arm64v8/debian:stretch-slim
|
||||||
ppc64le=ppc64le/debian:stretch-slim
|
linux/ppc64le=ppc64le/debian:stretch-slim
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
amd64=python:3.6-slim-stretch
|
linux/amd64=python:3.6-slim-stretch
|
||||||
arm64=arm64v8/python:3.6-slim-stretch
|
linux/arm64=arm64v8/python:3.6-slim-stretch
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
amd64=alpine:3.6
|
linux/amd64=alpine:3.6
|
||||||
arm=arm32v6/alpine:3.6
|
linux/arm=arm32v6/alpine:3.6
|
||||||
arm64=arm64v8/alpine:3.6
|
linux/arm64=arm64v8/alpine:3.6
|
||||||
ppc64le=ppc64le/alpine:3.6
|
linux/ppc64le=ppc64le/alpine:3.6
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=k8s.gcr.io/debian-base-amd64:v1.0.0
|
linux/amd64=k8s.gcr.io/debian-base-amd64:v1.0.0
|
||||||
arm=k8s.gcr.io/debian-base-arm:v1.0.0
|
linux/arm=k8s.gcr.io/debian-base-arm:v1.0.0
|
||||||
arm64=k8s.gcr.io/debian-base-arm64:v1.0.0
|
linux/arm64=k8s.gcr.io/debian-base-arm64:v1.0.0
|
||||||
ppc64le=k8s.gcr.io/debian-base-ppc64le:v1.0.0
|
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:v1.0.0
|
||||||
s390x=k8s.gcr.io/debian-base-s390x:v1.0.0
|
linux/s390x=k8s.gcr.io/debian-base-s390x:v1.0.0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
||||||
arm=k8s.gcr.io/debian-base-arm:0.4.1
|
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
|
||||||
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
||||||
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
||||||
arm=k8s.gcr.io/debian-base-arm:0.4.1
|
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
|
||||||
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
||||||
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=alpine:3.6
|
linux/amd64=alpine:3.6
|
||||||
arm=arm32v6/alpine:3.6
|
linux/arm=arm32v6/alpine:3.6
|
||||||
arm64=arm64v8/alpine:3.6
|
linux/arm64=arm64v8/alpine:3.6
|
||||||
ppc64le=ppc64le/alpine:3.6
|
linux/ppc64le=ppc64le/alpine:3.6
|
||||||
s390x=s390x/alpine:3.6
|
linux/s390x=s390x/alpine:3.6
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
|
||||||
arm=k8s.gcr.io/debian-base-arm:0.4.1
|
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
|
||||||
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
|
||||||
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
|
||||||
s390x=k8s.gcr.io/debian-base-s390x:0.4.1
|
linux/s390x=k8s.gcr.io/debian-base-s390x:0.4.1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=alpine:3.8
|
linux/amd64=alpine:3.8
|
||||||
arm=arm32v6/alpine:3.8
|
linux/arm=arm32v6/alpine:3.8
|
||||||
arm64=arm64v8/alpine:3.8
|
linux/arm64=arm64v8/alpine:3.8
|
||||||
ppc64le=ppc64le/alpine:3.8
|
linux/ppc64le=ppc64le/alpine:3.8
|
||||||
s390x=s390x/alpine:3.8
|
linux/s390x=s390x/alpine:3.8
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
amd64=alpine:3.8
|
linux/amd64=alpine:3.8
|
||||||
arm=arm32v6/alpine:3.8
|
linux/arm=arm32v6/alpine:3.8
|
||||||
arm64=arm64v8/alpine:3.8
|
linux/arm64=arm64v8/alpine:3.8
|
||||||
ppc64le=ppc64le/alpine:3.8
|
linux/ppc64le=ppc64le/alpine:3.8
|
||||||
s390x=s390x/alpine:3.8
|
linux/s390x=s390x/alpine:3.8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=fedora:28
|
linux/amd64=fedora:28
|
||||||
arm64=arm64v8/fedora:28
|
linux/arm64=arm64v8/fedora:28
|
||||||
ppc64le=ppc64le/fedora:28
|
linux/ppc64le=ppc64le/fedora:28
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=fedora:28
|
linux/amd64=fedora:28
|
||||||
arm64=arm64v8/fedora:28
|
linux/arm64=arm64v8/fedora:28
|
||||||
ppc64le=ppc64le/fedora:28
|
linux/ppc64le=ppc64le/fedora:28
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=centos:7
|
linux/amd64=centos:7
|
||||||
arm64=arm64v8/centos:7
|
linux/arm64=arm64v8/centos:7
|
||||||
ppc64le=ppc64le/centos:7
|
linux/ppc64le=ppc64le/centos:7
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
amd64=fedora:26
|
linux/amd64=fedora:26
|
||||||
arm64=arm64v8/fedora:26
|
linux/arm64=arm64v8/fedora:26
|
||||||
ppc64le=ppc64le/fedora:26
|
linux/ppc64le=ppc64le/fedora:26
|
||||||
|
Loading…
Reference in New Issue
Block a user