Skip to content

Commit f3a50f3

Browse files
committed
Fix Image Filtering (#245)
No idea why this got deleted in the first place!
1 parent bf2b2ae commit f3a50f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/server/handler/cluster/conversion.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,15 @@ func (g *generator) defaultImage(ctx context.Context, request *openapi.Kubernete
283283
return nil, errors.OAuth2ServerError("failed to list images").WithError(err)
284284
}
285285

286+
// Only get the version asked for.
287+
images = slices.DeleteFunc(images, func(x regionapi.Image) bool {
288+
return (*x.Spec.SoftwareVersions)["kubernetes"] != request.Spec.Version
289+
})
290+
291+
if len(images) == 0 {
292+
return nil, errors.OAuth2ServerError("unable to select an image")
293+
}
294+
286295
return &images[0], nil
287296
}
288297

0 commit comments

Comments
 (0)