mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-26 19:15:27 +00:00
Adds Windows support to the test/images/image-util.sh script. A Windows node with Docker installed is required to build Windows images. The connection URL to it must be set in the REMOTE_DOCKER_URL env variable. Additionally, the authentication to the remote docker node is done through certificates, which must be found in ~/.docker. By default, the REMOTE_DOCKER_URL env variable is set to "" in the Makefile, and because of it, the image-util.sh script will skip building and pushing Windows images. Added GOOS argument to the go build process in order to be able to build Windows binaries. Additionally, the OS env variable was added to the images Makefiles (default value is "linux") in order to maintain default behaviour. Some images require a different Dockerfile for Windows images, since they have different ways of installing dependencies. Because of this, if a image needs to be built for Windows, it will first check for a Dockerfile_windows file instead of the default one. If there isn't one, it means that the same Dockerfile can be used for both Windows and Linux. All Windows images will be based on the image "mcr.microsoft.com/windows/servercore:ltsc2019". There are a couple of features that are needed from this image, especially powershell. Added busybox image for Windows. Most Windows images will be based on it, which will help reduce the command line differences between Linux and Windows, but not entirely. Added Windows support for agnhost image.
65 lines
2.3 KiB
Plaintext
65 lines
2.3 KiB
Plaintext
# 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"]
|