Skip to content

Commit f099e34

Browse files
authored
Add ws2022 image/build to cri-containerd tests (microsoft#1160)
* Add ws2022 image/build to cri-integration tests This change adds a new case to the getWindowsServerCoreImage and getWindowsNanoserverImage functions to return ws2022 on a ws2022 or higher build. The higher case is because of some recent efforts to improve down-level compatability for Windows container images. For reference, the ltsc2022 image works on a win11 host without hypervisor isolation. Signed-off-by: Daniel Canter <[email protected]>
1 parent 7646525 commit f099e34

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/cri-containerd/main_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,16 @@ func getWindowsNanoserverImage(build uint16) string {
171171
return "mcr.microsoft.com/windows/nanoserver:2004"
172172
case osversion.V20H2:
173173
return "mcr.microsoft.com/windows/nanoserver:2009"
174+
case osversion.V21H2Server:
175+
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
174176
default:
177+
// Due to some efforts in improving down-level compatibility for Windows containers (see
178+
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
179+
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
180+
// if there's no mapping for the host build, just use the Windows Server 2022 image.
181+
if build > osversion.V21H2Server {
182+
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
183+
}
175184
panic("unsupported build")
176185
}
177186
}
@@ -188,7 +197,16 @@ func getWindowsServerCoreImage(build uint16) string {
188197
return "mcr.microsoft.com/windows/servercore:2004"
189198
case osversion.V20H2:
190199
return "mcr.microsoft.com/windows/servercore:2009"
200+
case osversion.V21H2Server:
201+
return "mcr.microsoft.com/windows/servercore:ltsc2022"
191202
default:
203+
// Due to some efforts in improving down-level compatibility for Windows containers (see
204+
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
205+
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
206+
// if there's no mapping for the host build, just use the Windows Server 2022 image.
207+
if build > osversion.V21H2Server {
208+
return "mcr.microsoft.com/windows/servercore:ltsc2022"
209+
}
192210
panic("unsupported build")
193211
}
194212
}

0 commit comments

Comments
 (0)