Skip to content

Commit 7de86ff

Browse files
authored
Merge pull request kubernetes#110379 from marosset/windows-pause-image-base
Updating base container image for pause image on Windows
2 parents 349efaa + 5375102 commit 7de86ff

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

build/dependencies.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ dependencies:
146146
match: __default_go_runner_version=
147147

148148
- name: "registry.k8s.io/pause"
149-
version: 3.7
149+
version: 3.8
150150
refPaths:
151151
- path: build/pause/Makefile
152152
match: TAG\s*\?=

build/pause/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 3.8
2+
3+
* Updating base image for Windows container images from nanoserver to `mcr.microsoft.com/oss/kubernetes/windows-pause-image-base` which gets built on a Windows machine.
4+
This addresses [Cannot modify registry keys during Windows pause image build process #109161](https://github.com/kubernetes/kubernetes/issues/109161)
5+
16
# 3.7
27

38
* Unsupported Windows Semi-Annual container images removed (OS Versions removed: 1903, 1909, 2004) . ([#107056](https://github.com/kubernetes/kubernetes/pull/107056), [@jsturtevant](https://github.com/jsturtevant/))

build/pause/Dockerfile_windows

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ ARG ARCH
1818
ADD bin/pause-windows-${ARCH}.exe /pause.exe
1919
ADD bin/wincat-windows-amd64 /Windows/System32/wincat.exe
2020

21-
# NOTE(claudiub): We're replacing the diagtrack.dll as a means to disable the
22-
# DiagTrack service (it cannot run without this DLL). We do not need this
23-
# service in the pause image and there's no reason for it to have any CPU usage.
24-
ADD windows/pause.c /Windows/System32/diagtrack.dll
25-
2621
# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH,
2722
# which is not desirable. See: https://github.com/moby/buildkit/issues/1560
2823
# TODO(claudiub): remove this once the issue has been resolved.

build/pause/Makefile

+11-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
REGISTRY ?= staging-k8s.gcr.io
1818
IMAGE = $(REGISTRY)/pause
1919

20-
TAG ?= 3.7
20+
TAG ?= 3.8
2121
REV = $(shell git describe --contains --always --match='v*')
2222

2323
# Architectures supported: amd64, arm, arm64, ppc64le and s390x
@@ -68,7 +68,8 @@ TRIPLE.linux-ppc64le := powerpc64le-linux-gnu
6868
TRIPLE.linux-s390x := s390x-linux-gnu
6969
TRIPLE := ${TRIPLE.${OS}-${ARCH}}
7070
BASE.linux := scratch
71-
BASE.windows := mcr.microsoft.com/windows/nanoserver
71+
# Source for windows pause image base is located at https://github.com/microsoft/windows-pause-image-base
72+
BASE.windows := mcr.microsoft.com/oss/kubernetes/windows-pause-image-base:v0.2
7273
BASE := ${BASE.${OS}}
7374

7475
# If you want to build AND push all containers, see the 'all-push' rule.
@@ -77,16 +78,21 @@ all: all-container-docker
7778
# NOTE(claudiub): A non-default builder instance is needed in order to build Windows images.
7879
all-push: all-container-registry push-manifest
7980

81+
push-manifest: SHELL:=/bin/bash
8082
push-manifest:
8183
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_OS_ARCH) | sed -e "s~[^ ]*~$(IMAGE):$(TAG)\-&~g")
8284
set -x; for arch in $(ALL_ARCH.linux); do docker manifest annotate --os linux --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}:${TAG}-linux-$${arch}; done
8385
# For Windows images, we also need to include the "os.version" in the manifest list, so the Windows node can pull the proper image it needs.
8486
# we use awk to also trim the quotes around the OS version string.
8587
set -x; \
88+
# tagToKernelVersionMap maps the container images tags for different Windows Server releases (ex: ltsc2022 for Windows Server 2022)
89+
# to the kernel version for that OS release (ex: 20348 for Windows Server 2022). This is needed to fetch the servicing revision from the
90+
# pause base image manifest (which containers an entry for each Windows Server version) so we can add the approrite 'os.version'
91+
# field to the pause image manifest.
92+
declare -A tagToKernelVersionMap=( ['1809']='17763' ['20H2']='19042' ['ltsc2022']='20348' );\
8693
for arch in $(ALL_ARCH.windows); do \
8794
for osversion in ${ALL_OSVERSIONS.windows}; do \
88-
BASEIMAGE=${BASE.windows}:$${osversion}; \
89-
full_version=`docker manifest inspect ${BASE.windows}:$${osversion} | grep "os.version" | head -n 1 | awk -F\" '{print $$4}'` || true; \
95+
full_version=`docker manifest inspect ${BASE.windows} | grep "10.0.$${tagToKernelVersionMap[$$osversion]}" | head -n 1 | awk -F\" '{print $$4}'` || true; \
9096
docker manifest annotate --os windows --arch $${arch} --os-version $${full_version} ${IMAGE}:${TAG} ${IMAGE}:${TAG}-windows-$${arch}-$${osversion}; \
9197
done; \
9298
done
@@ -122,7 +128,7 @@ container: .container-${OS}-$(ARCH)
122128

123129
.container-windows-$(ARCH): $(foreach binary, ${BIN}, bin/${binary}-${OS}-${ARCH})
124130
docker buildx build --pull --output=type=${OUTPUT_TYPE} --platform ${OS}/$(ARCH) \
125-
-t $(IMAGE):$(TAG)-${OS}-$(ARCH)-${OSVERSION} --build-arg BASE=${BASE}:${OSVERSION} --build-arg ARCH=$(ARCH) -f Dockerfile_windows .
131+
-t $(IMAGE):$(TAG)-${OS}-$(ARCH)-${OSVERSION} --build-arg BASE=${BASE}-windows-${OSVERSION}-${ARCH} --build-arg ARCH=$(ARCH) -f Dockerfile_windows .
126132
touch $@
127133

128134
# Useful for testing, not automatically included in container image

0 commit comments

Comments
 (0)