Skip to content

Commit af9e01f

Browse files
committed
Use new 21h2 server definitions
As three different builds of windows have the 21h2 moniker, use the server 21h2 definition Signed-off-by: Daniel Canter <[email protected]>
1 parent 38971c5 commit af9e01f

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

test/cri-containerd/main_test.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func getWindowsNanoserverImage(build uint16) string {
163163
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
164164
// the ltsc2022 image should continue to work on builds ws2022 and onwards. The panic for "unsupported build"
165165
// should only be triggered if the user is on 21h1 or a build older than RS5 now.
166-
if build > osversion.V21H2 {
167-
build = osversion.V21H2
166+
if build > osversion.V21H2Server {
167+
build = osversion.V21H2Server
168168
}
169169
switch build {
170170
case osversion.RS5:
@@ -177,26 +177,33 @@ func getWindowsNanoserverImage(build uint16) string {
177177
return "mcr.microsoft.com/windows/nanoserver:2004"
178178
case osversion.V20H2:
179179
return "mcr.microsoft.com/windows/nanoserver:2009"
180-
case osversion.V21H2:
180+
case osversion.V21H2Server:
181181
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
182182
default:
183183
panic("unsupported build")
184184
}
185185
}
186186

187187
func getWindowsServerCoreImage(build uint16) string {
188-
switch b := build; {
189-
case b == osversion.RS5:
188+
// Due to some efforts in improving down-level compatibility for Windows containers (see
189+
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
190+
// the ltsc2022 image should continue to work on builds ws2022 and onwards. The panic for "unsupported build"
191+
// should only be triggered if the user is on 21h1 or a build older than RS5 now.
192+
if build > osversion.V21H2Server {
193+
build = osversion.V21H2Server
194+
}
195+
switch build {
196+
case osversion.RS5:
190197
return "mcr.microsoft.com/windows/servercore:1809"
191-
case b == osversion.V19H1:
198+
case osversion.V19H1:
192199
return "mcr.microsoft.com/windows/servercore:1903"
193-
case b == osversion.V19H2:
200+
case osversion.V19H2:
194201
return "mcr.microsoft.com/windows/servercore:1909"
195-
case b == osversion.V20H1:
202+
case osversion.V20H1:
196203
return "mcr.microsoft.com/windows/servercore:2004"
197-
case b == osversion.V20H2:
204+
case osversion.V20H2:
198205
return "mcr.microsoft.com/windows/servercore:2009"
199-
case b >= osversion.V21H2:
206+
case osversion.V21H2Server:
200207
return "mcr.microsoft.com/windows/servercore:ltsc2022"
201208
default:
202209
panic("unsupported build")

0 commit comments

Comments
 (0)