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:
Claudiu Belu 2019-04-17 13:08:24 +00:00
parent 22a5fbcfa9
commit efcdb929de
24 changed files with 132 additions and 106 deletions

View File

@ -1,5 +1,5 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6
s390x=s390x/alpine:3.6
linux/amd64=alpine:3.6
linux/arm=arm32v6/alpine:3.6
linux/arm64=arm64v8/alpine:3.6
linux/ppc64le=ppc64le/alpine:3.6
linux/s390x=s390x/alpine:3.6

View File

@ -1,4 +1,4 @@
amd64=alpine:3.8
arm=arm32v6/alpine:3.8
arm64=arm64v8/alpine:3.8
ppc64le=ppc64le/alpine:3.8
linux/amd64=alpine:3.8
linux/arm=arm32v6/alpine:3.8
linux/arm64=arm64v8/alpine:3.8
linux/ppc64le=ppc64le/alpine:3.8

View File

@ -1,2 +1,2 @@
amd64=nvidia/cuda:10.0-devel-ubuntu18.04
ppc64le=nvidia/cuda-ppc64le:10.0-devel-ubuntu18.04
linux/amd64=nvidia/cuda:10.0-devel-ubuntu18.04
linux/ppc64le=nvidia/cuda-ppc64le:10.0-devel-ubuntu18.04

View File

@ -1,5 +1,5 @@
amd64=nginx:1.15-alpine
arm=arm32v6/nginx:1.15-alpine
arm64=arm64v8/nginx:1.15-alpine
ppc64le=ppc64le/nginx:1.15-alpine
s390x=s390x/nginx:1.15-alpine
linux/amd64=nginx:1.15-alpine
linux/arm=arm32v6/nginx:1.15-alpine
linux/arm64=arm64v8/nginx:1.15-alpine
linux/ppc64le=ppc64le/nginx:1.15-alpine
linux/s390x=s390x/nginx:1.15-alpine

View File

@ -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" )
# Returns list of all supported architectures from BASEIMAGE file
listArchs() {
listOsArchs() {
image=$1
cut -d "=" -f 1 "${image}"/BASEIMAGE
}
# Returns baseimage need to used in Dockerfile for any given architecture
getBaseImage() {
arch=$1
grep "${arch}=" BASEIMAGE | cut -d= -f2
os_name=$1
arch=$2
grep "${os_name}/${arch}=" BASEIMAGE | cut -d= -f2
}
# This function will build test image for all the architectures
@ -47,15 +48,24 @@ getBaseImage() {
build() {
image=$1
if [[ -f ${image}/BASEIMAGE ]]; then
archs=$(listArchs "$image")
os_archs=$(listOsArchs "$image")
else
archs=${!QEMUARCHS[*]}
# prepend linux/ to the QEMUARCHS items.
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
fi
kube::util::ensure-gnu-sed
for arch in ${archs}; do
echo "Building image for ${image} ARCH: ${arch}..."
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
echo "Building image for ${image} OS/ARCH: ${os_arch}..."
# Create a temporary directory for every architecture and copy the image content
# and build the image from temporary directory
@ -74,7 +84,7 @@ build() {
TAG=$(<VERSION)
if [[ -f BASEIMAGE ]]; then
BASEIMAGE=$(getBaseImage "${arch}")
BASEIMAGE=$(getBaseImage "${os_name}" "${arch}")
${SED} -i "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
${SED} -i "s|BASEARCH|${arch}|g" Dockerfile
fi
@ -121,11 +131,20 @@ push() {
docker_version_check
TAG=$(<"${image}"/VERSION)
if [[ -f ${image}/BASEIMAGE ]]; then
archs=$(listArchs "$image")
os_archs=$(listOsArchs "$image")
else
archs=${!QEMUARCHS[*]}
# prepend linux/ to the QEMUARCHS items.
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
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}"
done
@ -135,10 +154,17 @@ push() {
export DOCKER_CLI_EXPERIMENTAL="enabled"
# reset manifest list; needed in case multiple images are being built / pushed.
manifest=()
# Make archs list into image manifest. Eg: 'amd64 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")
# 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 "$os_archs" | ${SED} "s~linux\/~~" | ${SED} -e "s~[^ ]*~$REGISTRY\/$image\-&:$TAG~g")
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}"
done
docker manifest push --purge "${REGISTRY}/${image}:${TAG}"

View File

@ -1,4 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6
linux/amd64=alpine:3.6
linux/arm=arm32v6/alpine:3.6
linux/arm64=arm64v8/alpine:3.6
linux/ppc64le=ppc64le/alpine:3.6

View File

@ -1,5 +1,5 @@
amd64=debian:jessie
arm=arm32v7/debian:jessie
arm64=arm64v8/debian:jessie
ppc64le=ppc64le/debian:jessie
s390x=s390x/debian:jessie
linux/amd64=debian:jessie
linux/arm=arm32v7/debian:jessie
linux/arm64=arm64v8/debian:jessie
linux/ppc64le=ppc64le/debian:jessie
linux/s390x=s390x/debian:jessie

View File

@ -1,5 +1,5 @@
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
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
s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
linux/amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
linux/arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
linux/arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
linux/ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
linux/s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11

View File

@ -1,5 +1,5 @@
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
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
s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11
linux/amd64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-amd64:2.11
linux/arm=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm:2.11
linux/arm64=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-arm64:2.11
linux/ppc64le=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-ppc64le:2.11
linux/s390x=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost-s390x:2.11

View File

@ -1,3 +1,3 @@
amd64=debian:stretch-slim
arm64=arm64v8/debian:stretch-slim
ppc64le=ppc64le/debian:stretch-slim
linux/amd64=debian:stretch-slim
linux/arm64=arm64v8/debian:stretch-slim
linux/ppc64le=ppc64le/debian:stretch-slim

View File

@ -1,3 +1,3 @@
amd64=debian:stretch-slim
arm64=arm64v8/debian:stretch-slim
ppc64le=ppc64le/debian:stretch-slim
linux/amd64=debian:stretch-slim
linux/arm64=arm64v8/debian:stretch-slim
linux/ppc64le=ppc64le/debian:stretch-slim

View File

@ -1,2 +1,2 @@
amd64=python:3.6-slim-stretch
arm64=arm64v8/python:3.6-slim-stretch
linux/amd64=python:3.6-slim-stretch
linux/arm64=arm64v8/python:3.6-slim-stretch

View File

@ -1,4 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6
linux/amd64=alpine:3.6
linux/arm=arm32v6/alpine:3.6
linux/arm64=arm64v8/alpine:3.6
linux/ppc64le=ppc64le/alpine:3.6

View File

@ -1,5 +1,5 @@
amd64=k8s.gcr.io/debian-base-amd64:v1.0.0
arm=k8s.gcr.io/debian-base-arm:v1.0.0
arm64=k8s.gcr.io/debian-base-arm64:v1.0.0
ppc64le=k8s.gcr.io/debian-base-ppc64le:v1.0.0
s390x=k8s.gcr.io/debian-base-s390x:v1.0.0
linux/amd64=k8s.gcr.io/debian-base-amd64:v1.0.0
linux/arm=k8s.gcr.io/debian-base-arm:v1.0.0
linux/arm64=k8s.gcr.io/debian-base-arm64:v1.0.0
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:v1.0.0
linux/s390x=k8s.gcr.io/debian-base-s390x:v1.0.0

View File

@ -1,4 +1,4 @@
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
arm=k8s.gcr.io/debian-base-arm:0.4.1
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1

View File

@ -1,4 +1,4 @@
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
arm=k8s.gcr.io/debian-base-arm:0.4.1
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1

View File

@ -1,5 +1,5 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6
s390x=s390x/alpine:3.6
linux/amd64=alpine:3.6
linux/arm=arm32v6/alpine:3.6
linux/arm64=arm64v8/alpine:3.6
linux/ppc64le=ppc64le/alpine:3.6
linux/s390x=s390x/alpine:3.6

View File

@ -1,5 +1,5 @@
amd64=k8s.gcr.io/debian-base-amd64:0.4.1
arm=k8s.gcr.io/debian-base-arm:0.4.1
arm64=k8s.gcr.io/debian-base-arm64:0.4.1
ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
s390x=k8s.gcr.io/debian-base-s390x:0.4.1
linux/amd64=k8s.gcr.io/debian-base-amd64:0.4.1
linux/arm=k8s.gcr.io/debian-base-arm:0.4.1
linux/arm64=k8s.gcr.io/debian-base-arm64:0.4.1
linux/ppc64le=k8s.gcr.io/debian-base-ppc64le:0.4.1
linux/s390x=k8s.gcr.io/debian-base-s390x:0.4.1

View File

@ -1,5 +1,5 @@
amd64=alpine:3.8
arm=arm32v6/alpine:3.8
arm64=arm64v8/alpine:3.8
ppc64le=ppc64le/alpine:3.8
s390x=s390x/alpine:3.8
linux/amd64=alpine:3.8
linux/arm=arm32v6/alpine:3.8
linux/arm64=arm64v8/alpine:3.8
linux/ppc64le=ppc64le/alpine:3.8
linux/s390x=s390x/alpine:3.8

View File

@ -1,5 +1,5 @@
amd64=alpine:3.8
arm=arm32v6/alpine:3.8
arm64=arm64v8/alpine:3.8
ppc64le=ppc64le/alpine:3.8
s390x=s390x/alpine:3.8
linux/amd64=alpine:3.8
linux/arm=arm32v6/alpine:3.8
linux/arm64=arm64v8/alpine:3.8
linux/ppc64le=ppc64le/alpine:3.8
linux/s390x=s390x/alpine:3.8

View File

@ -1,3 +1,3 @@
amd64=fedora:28
arm64=arm64v8/fedora:28
ppc64le=ppc64le/fedora:28
linux/amd64=fedora:28
linux/arm64=arm64v8/fedora:28
linux/ppc64le=ppc64le/fedora:28

View File

@ -1,3 +1,3 @@
amd64=fedora:28
arm64=arm64v8/fedora:28
ppc64le=ppc64le/fedora:28
linux/amd64=fedora:28
linux/arm64=arm64v8/fedora:28
linux/ppc64le=ppc64le/fedora:28

View File

@ -1,3 +1,3 @@
amd64=centos:7
arm64=arm64v8/centos:7
ppc64le=ppc64le/centos:7
linux/amd64=centos:7
linux/arm64=arm64v8/centos:7
linux/ppc64le=ppc64le/centos:7

View File

@ -1,3 +1,3 @@
amd64=fedora:26
arm64=arm64v8/fedora:26
ppc64le=ppc64le/fedora:26
linux/amd64=fedora:26
linux/arm64=arm64v8/fedora:26
linux/ppc64le=ppc64le/fedora:26