Skip to content

Commit 6388b44

Browse files
committed
PR Feedback
Move build check to default case. Signed-off-by: Daniel Canter <[email protected]>
1 parent af9e01f commit 6388b44

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

test/cri-containerd/main_test.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,6 @@ func requireBinary(t *testing.T, binary string) string {
159159
}
160160

161161
func getWindowsNanoserverImage(build uint16) string {
162-
// Due to some efforts in improving down-level compatibility for Windows containers (see
163-
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
164-
// the ltsc2022 image should continue to work on builds ws2022 and onwards. The panic for "unsupported build"
165-
// should only be triggered if the user is on 21h1 or a build older than RS5 now.
166-
if build > osversion.V21H2Server {
167-
build = osversion.V21H2Server
168-
}
169162
switch build {
170163
case osversion.RS5:
171164
return "mcr.microsoft.com/windows/nanoserver:1809"
@@ -180,6 +173,13 @@ func getWindowsNanoserverImage(build uint16) string {
180173
case osversion.V21H2Server:
181174
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
182175
default:
176+
// Due to some efforts in improving down-level compatibility for Windows containers (see
177+
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
178+
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
179+
// if there's no mapping for the host build, just use the Windows Server 2022 image.
180+
if build > osversion.V21H2Server {
181+
return "mcr.microsoft.com/windows/nanoserver:ltsc2022"
182+
}
183183
panic("unsupported build")
184184
}
185185
}
@@ -206,6 +206,13 @@ func getWindowsServerCoreImage(build uint16) string {
206206
case osversion.V21H2Server:
207207
return "mcr.microsoft.com/windows/servercore:ltsc2022"
208208
default:
209+
// Due to some efforts in improving down-level compatibility for Windows containers (see
210+
// https://techcommunity.microsoft.com/t5/containers/windows-server-2022-and-beyond-for-containers/ba-p/2712487)
211+
// the ltsc2022 image should continue to work on builds ws2022 and onwards. With this in mind,
212+
// if there's no mapping for the host build, just use the Windows Server 2022 image.
213+
if build > osversion.V21H2Server {
214+
return "mcr.microsoft.com/windows/servercore:ltsc2022"
215+
}
209216
panic("unsupported build")
210217
}
211218
}

0 commit comments

Comments
 (0)