From 6816b2e7e968fe610fb5a91244031e38ff01499a Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Wed, 14 Oct 2020 04:29:17 -0700 Subject: [PATCH] test images: Adds dockerhub images for mirroring Dockerhub will introduce rate limiting in November, and a lot of E2E tests are relying on the busybox image. It could potentially become an issue causing jobs to fail because of this. Ideally, we'd have the busybox image mirrored on gcr.io, but that could take some time. Until then, we can just have the Image Builder mirror the image for us in the staging registry and use that for tests until this issue is solved. The busybox image should NOT be promoted out of staging. During the sig-testing meeting, it was decided that we should do the same for the other images are hosted on dockerhub. Two different versions of httpd and nginx have to be built, and thus, the have different folders. An ALIAS file was added to httpd-new and nginx-new in order to keep the same image name. --- test/images/busybox/BASEIMAGE | 5 ++++ test/images/busybox/Dockerfile | 17 +++++++++++ .../glusterdynamic-provisioner/BASEIMAGE | 1 + .../glusterdynamic-provisioner/Dockerfile | 17 +++++++++++ .../images/glusterdynamic-provisioner/VERSION | 1 + test/images/httpd-new/ALIAS | 1 + test/images/httpd-new/BASEIMAGE | 5 ++++ test/images/httpd-new/Dockerfile | 17 +++++++++++ test/images/httpd-new/VERSION | 1 + test/images/httpd/BASEIMAGE | 5 ++++ test/images/httpd/Dockerfile | 17 +++++++++++ test/images/httpd/VERSION | 1 + test/images/image-util.sh | 28 +++++++++++++++---- test/images/nginx-new/ALIAS | 1 + test/images/nginx-new/BASEIMAGE | 5 ++++ test/images/nginx-new/Dockerfile | 17 +++++++++++ test/images/nginx-new/VERSION | 1 + test/images/nginx/BASEIMAGE | 5 ++++ test/images/nginx/Dockerfile | 17 +++++++++++ test/images/nginx/VERSION | 1 + test/images/perl/BASEIMAGE | 5 ++++ test/images/perl/Dockerfile | 17 +++++++++++ test/images/perl/VERSION | 1 + 23 files changed, 180 insertions(+), 6 deletions(-) create mode 100644 test/images/busybox/Dockerfile create mode 100644 test/images/glusterdynamic-provisioner/BASEIMAGE create mode 100644 test/images/glusterdynamic-provisioner/Dockerfile create mode 100644 test/images/glusterdynamic-provisioner/VERSION create mode 100644 test/images/httpd-new/ALIAS create mode 100644 test/images/httpd-new/BASEIMAGE create mode 100644 test/images/httpd-new/Dockerfile create mode 100644 test/images/httpd-new/VERSION create mode 100644 test/images/httpd/BASEIMAGE create mode 100644 test/images/httpd/Dockerfile create mode 100644 test/images/httpd/VERSION create mode 100644 test/images/nginx-new/ALIAS create mode 100644 test/images/nginx-new/BASEIMAGE create mode 100644 test/images/nginx-new/Dockerfile create mode 100644 test/images/nginx-new/VERSION create mode 100644 test/images/nginx/BASEIMAGE create mode 100644 test/images/nginx/Dockerfile create mode 100644 test/images/nginx/VERSION create mode 100644 test/images/perl/BASEIMAGE create mode 100644 test/images/perl/Dockerfile create mode 100644 test/images/perl/VERSION diff --git a/test/images/busybox/BASEIMAGE b/test/images/busybox/BASEIMAGE index da963894f29..0bb96181e42 100644 --- a/test/images/busybox/BASEIMAGE +++ b/test/images/busybox/BASEIMAGE @@ -1,3 +1,8 @@ +linux/amd64=busybox:1.29 +linux/arm=arm32v6/busybox:1.29 +linux/arm64=arm64v8/busybox:1.29 +linux/ppc64le=ppc64le/busybox:1.29 +linux/s390x=s390x/busybox:1.29 windows/amd64/1809=mcr.microsoft.com/windows/nanoserver:1809 windows/amd64/1903=mcr.microsoft.com/windows/nanoserver:1903 windows/amd64/1909=mcr.microsoft.com/windows/nanoserver:1909 diff --git a/test/images/busybox/Dockerfile b/test/images/busybox/Dockerfile new file mode 100644 index 00000000000..09a6978c0b5 --- /dev/null +++ b/test/images/busybox/Dockerfile @@ -0,0 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# NOTE(claudiub): Noop. We're just mirroring the image to staging. +ARG BASEIMAGE +FROM $BASEIMAGE diff --git a/test/images/glusterdynamic-provisioner/BASEIMAGE b/test/images/glusterdynamic-provisioner/BASEIMAGE new file mode 100644 index 00000000000..37654db177f --- /dev/null +++ b/test/images/glusterdynamic-provisioner/BASEIMAGE @@ -0,0 +1 @@ +linux/amd64=docker.io/gluster/glusterdynamic-provisioner:v1.0 diff --git a/test/images/glusterdynamic-provisioner/Dockerfile b/test/images/glusterdynamic-provisioner/Dockerfile new file mode 100644 index 00000000000..09a6978c0b5 --- /dev/null +++ b/test/images/glusterdynamic-provisioner/Dockerfile @@ -0,0 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# NOTE(claudiub): Noop. We're just mirroring the image to staging. +ARG BASEIMAGE +FROM $BASEIMAGE diff --git a/test/images/glusterdynamic-provisioner/VERSION b/test/images/glusterdynamic-provisioner/VERSION new file mode 100644 index 00000000000..6b3126cee74 --- /dev/null +++ b/test/images/glusterdynamic-provisioner/VERSION @@ -0,0 +1 @@ +v1.0 diff --git a/test/images/httpd-new/ALIAS b/test/images/httpd-new/ALIAS new file mode 100644 index 00000000000..71e8b8eecba --- /dev/null +++ b/test/images/httpd-new/ALIAS @@ -0,0 +1 @@ +httpd diff --git a/test/images/httpd-new/BASEIMAGE b/test/images/httpd-new/BASEIMAGE new file mode 100644 index 00000000000..8a9f42037b6 --- /dev/null +++ b/test/images/httpd-new/BASEIMAGE @@ -0,0 +1,5 @@ +linux/amd64=httpd:2.4.39-alpine +linux/arm=arm32v6/httpd:2.4.39-alpine +linux/arm64=arm64v8/httpd:2.4.39-alpine +linux/ppc64le=ppc64le/httpd:2.4.39-alpine +linux/s390x=s390x/httpd:2.4.39-alpine diff --git a/test/images/httpd-new/Dockerfile b/test/images/httpd-new/Dockerfile new file mode 100644 index 00000000000..09a6978c0b5 --- /dev/null +++ b/test/images/httpd-new/Dockerfile @@ -0,0 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# NOTE(claudiub): Noop. We're just mirroring the image to staging. +ARG BASEIMAGE +FROM $BASEIMAGE diff --git a/test/images/httpd-new/VERSION b/test/images/httpd-new/VERSION new file mode 100644 index 00000000000..1831734640a --- /dev/null +++ b/test/images/httpd-new/VERSION @@ -0,0 +1 @@ +2.4.39-alpine diff --git a/test/images/httpd/BASEIMAGE b/test/images/httpd/BASEIMAGE new file mode 100644 index 00000000000..671f4b0fe5e --- /dev/null +++ b/test/images/httpd/BASEIMAGE @@ -0,0 +1,5 @@ +linux/amd64=httpd:2.4.38-alpine +linux/arm=arm32v6/httpd:2.4.38-alpine +linux/arm64=arm64v8/httpd:2.4.38-alpine +linux/ppc64le=ppc64le/httpd:2.4.38-alpine +linux/s390x=s390x/httpd:2.4.38-alpine diff --git a/test/images/httpd/Dockerfile b/test/images/httpd/Dockerfile new file mode 100644 index 00000000000..09a6978c0b5 --- /dev/null +++ b/test/images/httpd/Dockerfile @@ -0,0 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# NOTE(claudiub): Noop. We're just mirroring the image to staging. +ARG BASEIMAGE +FROM $BASEIMAGE diff --git a/test/images/httpd/VERSION b/test/images/httpd/VERSION new file mode 100644 index 00000000000..3e6d74f5e3a --- /dev/null +++ b/test/images/httpd/VERSION @@ -0,0 +1 @@ +2.4.38-alpine diff --git a/test/images/image-util.sh b/test/images/image-util.sh index 9cf483fe765..8f944c9c697 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -89,16 +89,26 @@ getBaseImage() { # arm64, ppc64le, s390x build() { image=$1 + img_folder=$1 output_type=$2 docker_version_check - if [[ -f ${image}/BASEIMAGE ]]; then + if [[ -f "${img_folder}/BASEIMAGE" ]]; then os_archs=$(listOsArchs "$image") else # prepend linux/ to the QEMUARCHS items. os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}") fi + # image tag + TAG=$(<"${img_folder}/VERSION") + + alias_name="$(cat "${img_folder}/ALIAS" 2>/dev/null || true)" + if [[ -n "${alias_name}" ]]; then + echo "Found an alias for '${image}'. Building / tagging image as '${alias_name}.'" + image="${alias_name}" + fi + kube::util::ensure-gnu-sed for os_arch in ${os_archs}; do @@ -116,15 +126,13 @@ build() { temp_dir=$(mktemp -d "${KUBE_ROOT}"/_tmp/test-images-build.XXXXXX) kube::util::trap_add "rm -rf ${temp_dir}" EXIT - cp -r "${image}"/* "${temp_dir}" - if [[ -f ${image}/Makefile ]]; then + cp -r "${img_folder}"/* "${temp_dir}" + if [[ -f ${img_folder}/Makefile ]]; then # make bin will take care of all the prerequisites needed # for building the docker image - make -C "${image}" bin OS="${os_name}" ARCH="${arch}" TARGET="${temp_dir}" + make -C "${img_folder}" bin OS="${os_name}" ARCH="${arch}" TARGET="${temp_dir}" fi pushd "${temp_dir}" - # image tag - TAG=$(