Commit Graph

7 Commits

Author SHA1 Message Date
Tonis Tiigi
af83e9af10 platforms: add support for matching amd64 variants
Correctly matches optional variants for amd64
arch. These should be used for standardized values
v1-v4 from https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels.

V1 remains the default and is cleared by default.
Pulling a higher variant will match the highest
available platform lower or equal to the provided one
when platformVector is used.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-18 20:13:37 -08:00
Akihiro Suda
e22ce0fa03
platforms: add subarchless version of Only()
`OnlyStrict()` returns a match comparer for a single platform.

Unlike `Only()`, `OnlyStrict()` does not match sub platforms.
So, "arm/vN" will not match "arm/vM" where M < N, and "amd64" will not also match "386".

`OnlyStrict()` matches non-canonical forms. So, "arm64" matches "arm/64/v8".

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-15 14:58:14 +09:00
Tianon Gravi
4073aaa7a9 Allow arm64 to fallback to arm (v8, v7, v6, v5)
This isn't supported by *all* arm64 chips, but it is common enough that I think it's worth an explicit fallback.  I think it will be more common for images to have arm64 support without arm support, but even if a user has an arm64 chip that does not support arm32, having it fail to run the arm32 image is an acceptable compromise (because it's non-trivial to detect arm32 support without running a binary, AFAIK).

Also, before this change the failure would've simply been "no such image" instead of "failed to run" so I think it's pretty reasonable to allow it to try the additional 32bit set of images just in case one of them actually does work (like it will on many popular chips like 64bit Raspberry Pis and AWS Graviton).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2021-01-13 09:19:08 -08:00
Tianon Gravi
5fa5f15de5 Add amd64->386 fallback
Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2021-01-11 16:18:19 -08:00
Tianon Gravi
9072b09145 Refactor platforms.Only with a "platformVector" helper
This improves the hard-coded list of ARM fallbacks in the `platform.Only` implementation (by doing a descending loop over variant numbers instead, which is all the hard-coded list was doing).

Making this a separate function can then more easily be recursive later for handling an `arm64`->`arm` fallback (or similar), but I think it makes the code a lot more clear too (so we're calculating a vector of platforms separately from building a matcher object).

This also makes a minor adjustment in `TestImagePullWithDistSourceLabel` which had an implicit assumption that `platforms.Only` would only ever result in a single suitable manifest, which isn't strictly true (and is likely failing as-is when run on any 32bit `arm` system that's `v6` or higher, which this fixes 😅).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2020-12-28 14:11:14 -08:00
Jaime Caamaño Ruiz
ad25c1a9c3 Improve ARM platform matching
This commit improves ARM platform matching in two instances:

* Some old kernels reported the CPU architecture of arm64 cpus as
  Aarch64 [1].
* In cases where the user is running with armv8 cpu and kernel but amrhf
  user land (so armhf containerd), a possibility given the compatibility
  of armv8 with armv7.

[1] https://elixir.bootlin.com/linux/v3.14.29/source/arch/arm64/kernel/setup.c#L420

Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
2019-05-10 16:27:20 +02:00
Derek McGowan
9edcfcc1cb
Add platform match comparer interface
Adds a new platform interface for matching and comparing platforms.
This new interface allows both filtering and ordering of platforms
to support running multiple platform and choosing the best platform.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-08-27 00:11:46 -07:00