Skip to content

Commit

Permalink
c8d/image: Add hostPlatformMatcher
Browse files Browse the repository at this point in the history
Subset of 842c5c5 which only adds the
`hostPlatformMatcher` method.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed Aug 27, 2024
1 parent 0a38589 commit ecd2b6f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daemon/containerd/platform_matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ func (c allPlatformsWithPreferenceMatcher) Match(_ ocispec.Platform) bool {
func (c allPlatformsWithPreferenceMatcher) Less(p1, p2 ocispec.Platform) bool {
return c.preferred.Less(p1, p2)
}

func (i *ImageService) hostPlatformMatcher() platforms.MatchComparer {
// Allow to override the host platform for testing purposes.
if i.defaultPlatformOverride != nil {
return i.defaultPlatformOverride
}
return platforms.Default()
}

0 comments on commit ecd2b6f

Please sign in to comment.