diff --git a/test/images/BUILD b/test/images/BUILD index 2f887f0b644..a068ae0951d 100644 --- a/test/images/BUILD +++ b/test/images/BUILD @@ -13,6 +13,7 @@ filegroup( ":package-srcs", "//test/images/agnhost:all-srcs", "//test/images/apparmor-loader:all-srcs", + "//test/images/busybox:all-srcs", "//test/images/echoserver:all-srcs", "//test/images/metadata-concealment:all-srcs", "//test/images/nonewprivs:all-srcs", diff --git a/test/images/README.md b/test/images/README.md index 4561aa1e33c..e4ed1ddf585 100644 --- a/test/images/README.md +++ b/test/images/README.md @@ -18,6 +18,75 @@ is recommended in order to avoid certain issues. The node must be able to push the images to the desired container registry, make sure you are authenticated with the registry you're pushing to. +Windows Container images are not built by default, since they cannot be built on Linux. For +that, a Windows node with Docker installed and configured for remote management is required. + + +### Windows node(s) setup + +In order to build the Windows container images, a node with Windows 10 or Windows Server 2019 +with the latest updates installed is required. The node will have to have Docker installed, +preferably version 18.06.0 or newer. + +Keep in mind that the Windows node might not be able to build container images for newer OS versions +than itself (even with `--isolation=hyperv`), so keeping the node up to date and / or upgrading it +to the latest Windows Server edition is ideal. + +Windows test images must be built for Windows Server 2019 (1809) and Windows Server 1903, thus, +if the node does not have Hyper-V enabled, or it is not supported, multiple Windows nodes are required, +one per OS version. + +Additionally, remote management must be configured for the node's Docker daemon. Exposing the +Docker daemon without requiring any authentication is not recommended, and thus, it must be +configured with TLS to ensure that only authorised people can interact with it. For this, the +following `powershell` script can be executed: + +```powershell +mkdir .docker +docker run --isolation=hyperv --user=ContainerAdministrator --rm ` + -e SERVER_NAME=$(hostname) ` + -e IP_ADDRESSES=127.0.0.1,YOUR_WINDOWS_BUILD_NODE_IP ` + -v "c:\programdata\docker:c:\programdata\docker" ` + -v "$env:USERPROFILE\.docker:c:\users\containeradministrator\.docker" stefanscherer/dockertls-windows:2.5.5 +# restart the Docker daemon. +Restart-Service docker +``` + +For more information about the above commands, you can check [here](https://hub.docker.com/r/stefanscherer/dockertls-windows/). + +A firewall rule to allow connections to the Docker daemon is necessary: + +```powershell +New-NetFirewallRule -DisplayName 'Docker SSL Inbound' -Profile @('Domain', 'Public', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort 2376 +``` + +If your Windows build node is hosted by a cloud provider, make sure the port `2376` is open for the node. +For example, in Azure, this is done by running the following command: + +```console +az vm open-port -g GROUP-NAME -n NODE-NAME --port 2376 +``` + +The `ca.pem`, `cert.pem`, and `key.pem` files that can be found in `$env:USERPROFILE\.docker` +will have to copied to the `~/.docker-${os_version)/` on the Linux build node, where `${os_version}` +is `1809` or `1903`. + +```powershell +scp.exe -r $env:USERPROFILE\.docker ubuntu@YOUR_LINUX_BUILD_NODE:/home/ubuntu/.docker-$os_version +``` + +After all this, the Linux build node should be able to connect to the Windows build node: + +```bash +docker --tlsverify --tlscacert ~/.docker-${os_version}/ca.pem --tlscert ~/.docker-${os_version}/cert.pem --tlskey ~/.docker-${os_version}/key.pem -H "$REMOTE_DOCKER_URL" version +``` + +For more information and troubleshooting about enabling Docker remote management, see +[here](https://docs.microsoft.com/en-us/virtualization/windowscontainers/management/manage_remotehost) + +Finally, the node must be able to push the images to the desired container registry, make sure you are +authenticated with the registry you're pushing to. + ## Making changes to images @@ -63,6 +132,9 @@ For this, you will need the image manifest list's digest, which can be obtained manifest-tool inspect --raw gcr.io/k8s-staging-e2e-test-images/${IMAGE_NAME}:${VERSION} | jq '.[0].Digest' ``` +The images are built through `make`. Since some images (e.g.: `busybox`) are used as a base for +other images, it is recommended to build them first, if needed. + ## Building images @@ -88,6 +160,14 @@ registry. That can changed by running this command instead: REGISTRY=foo_registry make all-push WHAT=agnhost ``` +In order to also include Windows Container images into the final manifest lists, the `REMOTE_DOCKER_URL` argument +in the form `tcp://[host]:[port][path]` (for more details, see [here]([https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option]/)) +will also have to be specified: + +```bash +REMOTE_DOCKER_URL_1909=remote_docker_url_1909 REMOTE_DOCKER_URL_1903=remote_docker_url_1903 REMOTE_DOCKER_URL_1809=remote_docker_url_1809 REGISTRY=foo_registry make all-push WHAT=test-webserver +``` + *NOTE* (for test `gcr.io` image publishers): Some tests (e.g.: `should serve a basic image on each replica with a private image`) require the `agnhost` image to be published in an authenticated repo as well: @@ -135,3 +215,15 @@ After all the above has been done, run the desired tests. ```bash sudo chmod o+x /etc/docker ``` + +`nc` is being used by some E2E tests, which is why we are including a Linux-like `nc.exe` into the Windows `busybox` image. The image could fail to build during that step with an error that looks like this: + +```console +re-exec error: exit status 1: output: time="..." level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) path=\\\\?\\C:\\ProgramData\\... +``` + +The issue is caused by the Windows Defender which is removing the `nc.exe` binary from the filesystem. For more details on this issue, see [here](https://github.com/diegocr/netcat/issues/6). To fix this, you can simply run the following powershell command to temporarily disable Windows Defender: + +```powershell +Set-MpPreference -DisableRealtimeMonitoring $true +``` diff --git a/test/images/agnhost/BASEIMAGE b/test/images/agnhost/BASEIMAGE index 7bad7a6d3a2..cc7c45a7657 100644 --- a/test/images/agnhost/BASEIMAGE +++ b/test/images/agnhost/BASEIMAGE @@ -1,5 +1,8 @@ -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 +windows/amd64/1809=REGISTRY/busybox:1.29-windows-amd64-1809 +windows/amd64/1903=REGISTRY/busybox:1.29-windows-amd64-1903 +windows/amd64/1909=REGISTRY/busybox:1.29-windows-amd64-1909 diff --git a/test/images/agnhost/Dockerfile b/test/images/agnhost/Dockerfile index c551802c792..3cfe56c9cb2 100644 --- a/test/images/agnhost/Dockerfile +++ b/test/images/agnhost/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/agnhost/Dockerfile_windows b/test/images/agnhost/Dockerfile_windows new file mode 100644 index 00000000000..76edbdbb510 --- /dev/null +++ b/test/images/agnhost/Dockerfile_windows @@ -0,0 +1,64 @@ +# 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. + +ARG BASEIMAGE +FROM $BASEIMAGE + +# from dnsutils image +# install necessary packages: +# - bind-tools: contains dig, which can used in DNS tests. +# - CoreDNS: used in some DNS tests. +# from hostexec image +# installed necessary packages: +# - curl, nc: used by a lot of e2e tests (inherited from BASEIMAGE) +# from iperf image +# install necessary packages: iperf +ENV chocolateyUseWindowsCompression false +RUN powershell -Command "\ + iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \ + choco feature disable --name showDownloadProgress; \ + choco install bind-toolsonly --version 9.10.3 -y +RUN powershell -Command "\ + wget -uri 'https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_windows_amd64.tgz' -OutFile C:\coredns.tgz;\ + tar -xzvf C:\coredns.tgz;\ + Remove-Item C:\coredns.tgz" + +RUN powershell -Command "\ + wget -uri 'https://iperf.fr/download/windows/iperf-2.0.9-win64.zip' -OutFile C:\iperf.zip;\ + Expand-Archive -Path C:\iperf.zip -DestinationPath C:\ -Force;\ + Rename-Item C:\iperf-2.0.9-win64 C:\iperf;\ + Remove-Item C:\iperf.zip" + +# PORT 80 needed by: test-webserver +# PORT 8080 needed by: netexec, nettest +# PORT 8081 needed by: netexec +# PORT 9376 needed by: serve-hostname +EXPOSE 80 8080 8081 9376 + +# from netexec +RUN mkdir C:\uploads + +# from porter +ADD porter/localhost.crt localhost.crt +ADD porter/localhost.key localhost.key + +ADD agnhost agnhost + +# needed for the entrypoint-tester related tests. Some of the entrypoint-tester related tests +# overrides this image's entrypoint with agnhost-2 binary, and will verify that the correct +# entrypoint is used by the containers. +RUN mklink agnhost-2 agnhost + +ENTRYPOINT ["/agnhost"] +CMD ["pause"] diff --git a/test/images/agnhost/Makefile b/test/images/agnhost/Makefile index c21639c38c2..c5eeeea4162 100644 --- a/test/images/agnhost/Makefile +++ b/test/images/agnhost/Makefile @@ -13,6 +13,7 @@ # limitations under the License. SRCS=agnhost +OS ?= linux ARCH ?= amd64 TARGET ?= $(CURDIR) GOLANG_VERSION ?= latest diff --git a/test/images/agnhost/README.md b/test/images/agnhost/README.md index b797ee47f57..0b44449c231 100644 --- a/test/images/agnhost/README.md +++ b/test/images/agnhost/README.md @@ -40,7 +40,7 @@ For example, let's consider the following `pod.yaml` file: containers: - args: - dns-suffix - image: us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10 + image: us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 name: agnhost dnsConfig: nameservers: @@ -207,7 +207,7 @@ Usage: ```console guestbook="test/e2e/testing-manifests/guestbook" -sed_expr="s|{{.AgnhostImage}}|us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10|" +sed_expr="s|{{.AgnhostImage}}|us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11|" # create the services. kubectl create -f ${guestbook}/frontend-service.yaml @@ -290,14 +290,14 @@ Examples: ```console docker run -i \ - us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10 \ + us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \ logs-generator --log-lines-total 10 --run-duration 1s ``` ```console kubectl run logs-generator \ --generator=run-pod/v1 \ - --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10 \ + --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \ --restart=Never \ -- logs-generator -t 10 -d 1s ``` @@ -455,7 +455,7 @@ Usage: ```console kubectl run test-agnhost \ --generator=run-pod/v1 \ - --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10 \ + --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \ --restart=Never \ --env "POD_IP=" \ --env "NODE_IP=" \ @@ -510,7 +510,7 @@ Usage: ```console kubectl run test-agnhost \ --generator=run-pod/v1 \ - --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10 \ + --image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \ --restart=Never \ --env "BIND_ADDRESS=localhost" \ --env "BIND_PORT=8080" \ @@ -626,11 +626,18 @@ Usage: ## Other tools -The image contains `iperf`, `curl`, `dns-tools` (including `dig`), CoreDNS. +The image contains `iperf`, `curl`, `dns-tools` (including `dig`), CoreDNS, for both Windows and Linux. + +For Windows, the image is based on `busybox`, meaning that most of the Linux common tools are also +available on it, making it possible to run most Linux commands in the `agnhost` Windows container +as well. Keep in mind that there might still be some differences though (e.g.: `wget` does not +have the `-T` argument on Windows). + +The Windows `agnhost` image includes a `nc` binary that is 100% compliant with its Linux equivalent. ## Image -The image can be found at `us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.10` for Linux -containers, and `e2eteam/agnhost:2.10` for Windows containers. In the future, the same -repository can be used for both OSes. +The image can be found at `us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11` for both Linux and +Windows containers (based on `mcr.microsoft.com/windows/servercore:ltsc2019`, +`mcr.microsoft.com/windows/servercore:1903`, and `mcr.microsoft.com/windows/servercore:1909`). diff --git a/test/images/agnhost/VERSION b/test/images/agnhost/VERSION index 37989bd16b4..6a5fe6e8977 100644 --- a/test/images/agnhost/VERSION +++ b/test/images/agnhost/VERSION @@ -1 +1 @@ -2.10 +2.11 diff --git a/test/images/agnhost/agnhost.go b/test/images/agnhost/agnhost.go index 6d6510d8c71..ca82e93c2b8 100644 --- a/test/images/agnhost/agnhost.go +++ b/test/images/agnhost/agnhost.go @@ -48,7 +48,7 @@ import ( ) func main() { - rootCmd := &cobra.Command{Use: "app", Version: "2.10"} + rootCmd := &cobra.Command{Use: "app", Version: "2.11"} rootCmd.AddCommand(auditproxy.CmdAuditProxy) rootCmd.AddCommand(connect.CmdConnect) diff --git a/test/images/apparmor-loader/BASEIMAGE b/test/images/apparmor-loader/BASEIMAGE index 960ad547f94..8d99f110a96 100644 --- a/test/images/apparmor-loader/BASEIMAGE +++ b/test/images/apparmor-loader/BASEIMAGE @@ -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 diff --git a/test/images/apparmor-loader/Dockerfile b/test/images/apparmor-loader/Dockerfile index 0cad6e26eef..c6e38ae7e75 100644 --- a/test/images/apparmor-loader/Dockerfile +++ b/test/images/apparmor-loader/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/apparmor-loader/Makefile b/test/images/apparmor-loader/Makefile index 807d3a2a489..c0b6bd8e481 100644 --- a/test/images/apparmor-loader/Makefile +++ b/test/images/apparmor-loader/Makefile @@ -13,6 +13,7 @@ # limitations under the License. SRCS=loader +OS ?= linux ARCH ?= amd64 TARGET ?= $(CURDIR) GOLANG_VERSION ?= latest diff --git a/test/images/apparmor-loader/VERSION b/test/images/apparmor-loader/VERSION index d3827e75a5c..9459d4ba2a0 100644 --- a/test/images/apparmor-loader/VERSION +++ b/test/images/apparmor-loader/VERSION @@ -1 +1 @@ -1.0 +1.1 diff --git a/test/images/busybox/BASEIMAGE b/test/images/busybox/BASEIMAGE new file mode 100644 index 00000000000..ce71d103b81 --- /dev/null +++ b/test/images/busybox/BASEIMAGE @@ -0,0 +1,3 @@ +windows/amd64/1809=mcr.microsoft.com/windows/servercore:ltsc2019 +windows/amd64/1903=mcr.microsoft.com/windows/servercore:1903 +windows/amd64/1909=mcr.microsoft.com/windows/servercore:1909 diff --git a/test/images/busybox/BUILD b/test/images/busybox/BUILD new file mode 100644 index 00000000000..f1d2087ff43 --- /dev/null +++ b/test/images/busybox/BUILD @@ -0,0 +1,31 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_binary", + "go_library", +) + +go_binary( + name = "hostname", + embed = [":go_default_library"], +) + +go_library( + name = "go_default_library", + srcs = ["hostname.go"], + importpath = "k8s.io/kubernetes/test/images/busybox", +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) diff --git a/test/images/busybox/Dockerfile_windows b/test/images/busybox/Dockerfile_windows new file mode 100644 index 00000000000..c4a508fa96a --- /dev/null +++ b/test/images/busybox/Dockerfile_windows @@ -0,0 +1,34 @@ +# 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. + +ARG BASEIMAGE +from $BASEIMAGE as prep + +ENV CURL_VERSION 7.57.0 +WORKDIR /curl +ADD https://skanthak.homepage.t-online.de/download/curl-$CURL_VERSION.cab curl.cab +RUN expand /R curl.cab /F:* . + +FROM $BASEIMAGE + +COPY --from=prep /curl/AMD64 /curl +COPY --from=prep /curl/CURL.LIC /curl +ADD https://github.com/kubernetes-sigs/windows-testing/raw/master/images/busybox/busybox.exe /bin/busybox.exe +ADD https://github.com/diegocr/netcat/raw/master/nc.exe /bin/nc.exe +ADD hostname /bin/hostname.exe +USER ContainerAdministrator +RUN FOR /f "tokens=*" %i IN ('C:\bin\busybox --list') DO mklink C:\bin\%i.exe C:\bin\busybox.exe +RUN setx /M PATH "C:\bin;C:\curl\;%PATH%" &\ + mkdir C:\tmp +ENTRYPOINT ["cmd.exe", "/s", "/c"] diff --git a/test/images/busybox/Makefile b/test/images/busybox/Makefile new file mode 100644 index 00000000000..ca3bd80c5ae --- /dev/null +++ b/test/images/busybox/Makefile @@ -0,0 +1,27 @@ +# 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. + +SRCS=hostname +OS ?= linux +ARCH ?= amd64 +TARGET ?= $(CURDIR) +GOARM = 7 +GOLANG_VERSION ?= latest +SRC_DIR = $(notdir $(shell pwd)) +export + +bin: + ../image-util.sh bin $(SRCS) + +.PHONY: bin diff --git a/test/images/busybox/VERSION b/test/images/busybox/VERSION new file mode 100644 index 00000000000..9de53f1932a --- /dev/null +++ b/test/images/busybox/VERSION @@ -0,0 +1 @@ +1.29 diff --git a/test/images/busybox/hostname.go b/test/images/busybox/hostname.go new file mode 100644 index 00000000000..77694dad16a --- /dev/null +++ b/test/images/busybox/hostname.go @@ -0,0 +1,50 @@ +/* +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. +*/ + +package main + +import ( + "flag" + "fmt" + "log" + "net" + "os" +) + +func getOutboundIP() net.IP { + conn, err := net.Dial("udp", "8.8.8.8:80") + if err != nil { + log.Fatal(err) + } + defer conn.Close() + localAddr := conn.LocalAddr().(*net.UDPAddr) + return localAddr.IP +} + +func main() { + flagIP := flag.Bool("i", false, "a string") + flag.Parse() + if *flagIP { + ip := getOutboundIP() + fmt.Print(ip.String()) + } else { + hostname, err := os.Hostname() + if err != nil { + log.Fatal(err) + } + fmt.Print(hostname) + } +} diff --git a/test/images/cloudbuild.yaml b/test/images/cloudbuild.yaml index 29be75e48bc..099d4615930 100644 --- a/test/images/cloudbuild.yaml +++ b/test/images/cloudbuild.yaml @@ -17,6 +17,9 @@ steps: - BASE_REF=$_PULL_BASE_REF - WHAT=$_WHAT - REGISTRY=gcr.io/k8s-staging-e2e-test-images + - REMOTE_DOCKER_URL_1809=tcp://img-promoter-1809.eastus.cloudapp.azure.com:2376 + - REMOTE_DOCKER_URL_1903=tcp://img-promoter-1903.eastus.cloudapp.azure.com:2376 + - REMOTE_DOCKER_URL_1909=tcp://img-promoter-1909.eastus.cloudapp.azure.com:2376 args: - all-push substitutions: diff --git a/test/images/cuda-vector-add/BASEIMAGE b/test/images/cuda-vector-add/BASEIMAGE index 89b44efb366..5e5cd4dac28 100644 --- a/test/images/cuda-vector-add/BASEIMAGE +++ b/test/images/cuda-vector-add/BASEIMAGE @@ -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 diff --git a/test/images/cuda-vector-add/Dockerfile b/test/images/cuda-vector-add/Dockerfile index 968626bf424..af82e6a5e9b 100644 --- a/test/images/cuda-vector-add/Dockerfile +++ b/test/images/cuda-vector-add/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/cuda-vector-add/VERSION b/test/images/cuda-vector-add/VERSION index cd5ac039d67..879b416e609 100644 --- a/test/images/cuda-vector-add/VERSION +++ b/test/images/cuda-vector-add/VERSION @@ -1 +1 @@ -2.0 +2.1 diff --git a/test/images/echoserver/BASEIMAGE b/test/images/echoserver/BASEIMAGE index d27954b62e8..269c92ac3ad 100644 --- a/test/images/echoserver/BASEIMAGE +++ b/test/images/echoserver/BASEIMAGE @@ -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 diff --git a/test/images/echoserver/Dockerfile b/test/images/echoserver/Dockerfile index 919f39dba8e..3329cdf458c 100644 --- a/test/images/echoserver/Dockerfile +++ b/test/images/echoserver/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/echoserver/VERSION b/test/images/echoserver/VERSION index 8bbe6cf74a1..bb576dbde10 100644 --- a/test/images/echoserver/VERSION +++ b/test/images/echoserver/VERSION @@ -1 +1 @@ -2.2 +2.3 diff --git a/test/images/image-util.sh b/test/images/image-util.sh index 99e91f4d803..3c62ecd736e 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -29,15 +29,15 @@ 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_arch=$1 + grep "${os_arch}=" BASEIMAGE | cut -d= -f2 } # This function will build test image for all the architectures @@ -47,15 +47,36 @@ 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 + # for Windows, we have to support both LTS and SAC channels, so we're building multiple Windows images. + # the format for this case is: OS/ARCH/OS_VERSION. + os_name=$(echo "$os_arch" | cut -d "/" -f 1) + arch=$(echo "$os_arch" | cut -d "/" -f 2) + os_version=$(echo "$os_arch" | cut -d "/" -f 3) + + # currently, GCE does not have Hyper-V support, which means that the same node cannot be used to build + # multiple versions of Windows images. Which is why we have $REMOTE_DOCKER_URL_$os_version URLs configured. + # TODO(claudiub): once Hyper-V support has been added to GCE, revert this to just $REMOTE_DOCKER_URL. + remote_docker_url_name="REMOTE_DOCKER_URL_$os_version" + REMOTE_DOCKER_URL=$(eval echo "\${${remote_docker_url_name}:-}") + elif [[ $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 @@ -67,16 +88,24 @@ build() { if [[ -f ${image}/Makefile ]]; then # make bin will take care of all the prerequisites needed # for building the docker image - make -C "${image}" bin ARCH="${arch}" TARGET="${temp_dir}" + make -C "${image}" bin OS="${os_name}" ARCH="${arch}" TARGET="${temp_dir}" fi pushd "${temp_dir}" # image tag TAG=$(:8080/ConsumeCP ## Image -Docker image of Resource Consumer can be found in Google Container Registry as gcr.io/kubernetes-e2e-test-images/resource-consumer:1.4 +Docker image of Resource Consumer can be found in Google Container Registry as gcr.io/kubernetes-e2e-test-images/resource-consumer:1.7 ## Use cases diff --git a/test/images/resource-consumer/VERSION b/test/images/resource-consumer/VERSION index 810ee4e91e2..d3bdbdf1fda 100644 --- a/test/images/resource-consumer/VERSION +++ b/test/images/resource-consumer/VERSION @@ -1 +1 @@ -1.6 +1.7 diff --git a/test/images/sample-apiserver/BASEIMAGE b/test/images/sample-apiserver/BASEIMAGE index a6161331615..0b0e6ddd30a 100644 --- a/test/images/sample-apiserver/BASEIMAGE +++ b/test/images/sample-apiserver/BASEIMAGE @@ -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 diff --git a/test/images/sample-apiserver/Dockerfile b/test/images/sample-apiserver/Dockerfile index 69f3526c0f4..b5a2a7e265b 100644 --- a/test/images/sample-apiserver/Dockerfile +++ b/test/images/sample-apiserver/Dockerfile @@ -32,7 +32,8 @@ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=BASEARCH go get k8s.io/sample # we can copy it out from this throw away container image from a standard location RUN find /go/bin -name sample-apiserver -exec cp {} / \; -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE COPY --from=build_k8s_1_17_sample_apiserver /sample-apiserver /sample-apiserver ENTRYPOINT ["/sample-apiserver"] diff --git a/test/images/sample-apiserver/VERSION b/test/images/sample-apiserver/VERSION index 06fb41b6322..b9a05a6dc1d 100644 --- a/test/images/sample-apiserver/VERSION +++ b/test/images/sample-apiserver/VERSION @@ -1 +1 @@ -1.17.2 +1.17.3 diff --git a/test/images/sample-device-plugin/BASEIMAGE b/test/images/sample-device-plugin/BASEIMAGE index a6161331615..0b0e6ddd30a 100644 --- a/test/images/sample-device-plugin/BASEIMAGE +++ b/test/images/sample-device-plugin/BASEIMAGE @@ -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 diff --git a/test/images/sample-device-plugin/Dockerfile b/test/images/sample-device-plugin/Dockerfile index 206e0ba645c..0e05f8e56da 100644 --- a/test/images/sample-device-plugin/Dockerfile +++ b/test/images/sample-device-plugin/Dockerfile @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE ADD sampledeviceplugin /sampledeviceplugin ENTRYPOINT ["/sampledeviceplugin", "-alsologtostderr"] diff --git a/test/images/sample-device-plugin/Makefile b/test/images/sample-device-plugin/Makefile index a7921439c67..c3fa3cb23e4 100644 --- a/test/images/sample-device-plugin/Makefile +++ b/test/images/sample-device-plugin/Makefile @@ -13,6 +13,7 @@ # limitations under the License. SRCS=sampledeviceplugin +OS ?= linux ARCH ?= amd64 TARGET ?= $(CURDIR) GOLANG_VERSION ?= latest diff --git a/test/images/sample-device-plugin/VERSION b/test/images/sample-device-plugin/VERSION index d3827e75a5c..9459d4ba2a0 100644 --- a/test/images/sample-device-plugin/VERSION +++ b/test/images/sample-device-plugin/VERSION @@ -1 +1 @@ -1.0 +1.1 diff --git a/test/images/volume/gluster/BASEIMAGE b/test/images/volume/gluster/BASEIMAGE index 1db25cbc831..c249e62e346 100644 --- a/test/images/volume/gluster/BASEIMAGE +++ b/test/images/volume/gluster/BASEIMAGE @@ -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 diff --git a/test/images/volume/gluster/Dockerfile b/test/images/volume/gluster/Dockerfile index 3cfa358eb01..cbbcb71efb4 100644 --- a/test/images/volume/gluster/Dockerfile +++ b/test/images/volume/gluster/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/volume/gluster/VERSION b/test/images/volume/gluster/VERSION index d3827e75a5c..9459d4ba2a0 100644 --- a/test/images/volume/gluster/VERSION +++ b/test/images/volume/gluster/VERSION @@ -1 +1 @@ -1.0 +1.1 diff --git a/test/images/volume/iscsi/BASEIMAGE b/test/images/volume/iscsi/BASEIMAGE index 1db25cbc831..c249e62e346 100644 --- a/test/images/volume/iscsi/BASEIMAGE +++ b/test/images/volume/iscsi/BASEIMAGE @@ -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 diff --git a/test/images/volume/iscsi/Dockerfile b/test/images/volume/iscsi/Dockerfile index bff98b575be..02106d54835 100644 --- a/test/images/volume/iscsi/Dockerfile +++ b/test/images/volume/iscsi/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/volume/iscsi/VERSION b/test/images/volume/iscsi/VERSION index cd5ac039d67..879b416e609 100644 --- a/test/images/volume/iscsi/VERSION +++ b/test/images/volume/iscsi/VERSION @@ -1 +1 @@ -2.0 +2.1 diff --git a/test/images/volume/nfs/BASEIMAGE b/test/images/volume/nfs/BASEIMAGE index c269d713256..20a4ae1b009 100644 --- a/test/images/volume/nfs/BASEIMAGE +++ b/test/images/volume/nfs/BASEIMAGE @@ -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 diff --git a/test/images/volume/nfs/Dockerfile b/test/images/volume/nfs/Dockerfile index 2af5f1c4b4c..f6b184c6dc6 100644 --- a/test/images/volume/nfs/Dockerfile +++ b/test/images/volume/nfs/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ RUN yum -y install /usr/bin/ps nfs-utils && yum clean all diff --git a/test/images/volume/nfs/VERSION b/test/images/volume/nfs/VERSION index d3827e75a5c..9459d4ba2a0 100644 --- a/test/images/volume/nfs/VERSION +++ b/test/images/volume/nfs/VERSION @@ -1 +1 @@ -1.0 +1.1 diff --git a/test/images/volume/rbd/BASEIMAGE b/test/images/volume/rbd/BASEIMAGE index 872b2959679..3c320a09162 100644 --- a/test/images/volume/rbd/BASEIMAGE +++ b/test/images/volume/rbd/BASEIMAGE @@ -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 diff --git a/test/images/volume/rbd/Dockerfile b/test/images/volume/rbd/Dockerfile index ad6bb314ef5..40742f60dec 100644 --- a/test/images/volume/rbd/Dockerfile +++ b/test/images/volume/rbd/Dockerfile @@ -15,7 +15,8 @@ # CEPH all in one # Based on image by Ricardo Rocha, ricardo@catalyst.net.nz -FROM BASEIMAGE +ARG BASEIMAGE +FROM $BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ diff --git a/test/images/volume/rbd/VERSION b/test/images/volume/rbd/VERSION index 7dea76edb3d..6d7de6e6abe 100644 --- a/test/images/volume/rbd/VERSION +++ b/test/images/volume/rbd/VERSION @@ -1 +1 @@ -1.0.1 +1.0.2