Skip to content

Commit

Permalink
Add ws2022 image/build to cri-integration tests
Browse files Browse the repository at this point in the history
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 <dcanter@microsoft.com>
  • Loading branch information
dcantah committed Sep 14, 2021
1 parent 7866b48 commit 78ce850
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions test/cri-containerd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ func requireBinary(t *testing.T, binary string) string {
}

func getWindowsNanoserverImage(build uint16) string {
// 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. The panic for "unsupported build"
// should only be triggered if the user is on a build older than RS5 or 21h1 now.
if build > osversion.V21H2 {
build = osversion.V21H2
}
switch build {
case osversion.RS5:
return "mcr.microsoft.com/windows/nanoserver:1809"
Expand All @@ -160,23 +167,27 @@ func getWindowsNanoserverImage(build uint16) string {
return "mcr.microsoft.com/windows/nanoserver:2004"
case osversion.V20H2:
return "mcr.microsoft.com/windows/nanoserver:2009"
case osversion.V21H2:
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
default:
panic("unsupported build")
}
}

func getWindowsServerCoreImage(build uint16) string {
switch build {
case osversion.RS5:
switch b := build; {
case b == osversion.RS5:
return "mcr.microsoft.com/windows/servercore:1809"
case osversion.V19H1:
case b == osversion.V19H1:
return "mcr.microsoft.com/windows/servercore:1903"
case osversion.V19H2:
case b == osversion.V19H2:
return "mcr.microsoft.com/windows/servercore:1909"
case osversion.V20H1:
case b == osversion.V20H1:
return "mcr.microsoft.com/windows/servercore:2004"
case osversion.V20H2:
case b == osversion.V20H2:
return "mcr.microsoft.com/windows/servercore:2009"
case b >= osversion.V21H2:
return "mcr.microsoft.com/windows/servercore:ltsc2022"
default:
panic("unsupported build")
}
Expand Down

0 comments on commit 78ce850

Please sign in to comment.