Skip to content

Commit

Permalink
Add ws2022 image/build to cri-containerd tests (microsoft#1160)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
dcantah committed Dec 1, 2021
1 parent 7646525 commit f099e34
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/cri-containerd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,16 @@ func getWindowsNanoserverImage(build uint16) string {
return "mcr.microsoft.com/windows/nanoserver:2004"
case osversion.V20H2:
return "mcr.microsoft.com/windows/nanoserver:2009"
case osversion.V21H2Server:
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
default:
// Due to some efforts in improving down-level compatibility for Windows containers (see
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
// if there's no mapping for the host build, just use the Windows Server 2022 image.
if build > osversion.V21H2Server {
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
}
panic("unsupported build")
}
}
Expand All @@ -188,7 +197,16 @@ func getWindowsServerCoreImage(build uint16) string {
return "mcr.microsoft.com/windows/servercore:2004"
case osversion.V20H2:
return "mcr.microsoft.com/windows/servercore:2009"
case osversion.V21H2Server:
return "mcr.microsoft.com/windows/servercore:ltsc2022"
default:
// Due to some efforts in improving down-level compatibility for Windows containers (see
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
// if there's no mapping for the host build, just use the Windows Server 2022 image.
if build > osversion.V21H2Server {
return "mcr.microsoft.com/windows/servercore:ltsc2022"
}
panic("unsupported build")
}
}
Expand Down

0 comments on commit f099e34

Please sign in to comment.