From 87d66096fc8f40e668f1f1917018bf55cf9921f1 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 23 May 2024 14:42:52 +0200 Subject: [PATCH 1/4] Fix ocibundle for 32bit arm We may run k0s on arm/v8 but only have images for arm/v7. Use Only() instead of OnlyStrinct() to also match arm/v7 on arm/v8. Fixes commit 9dd47b48f7a1 (#1939 Fix airgap arm64 build. Strictly use target platform only) ref: https://pkg.go.dev/github.com/containerd/containerd/platforms#Only Signed-off-by: Natanael Copa --- pkg/component/worker/ocibundle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/component/worker/ocibundle.go b/pkg/component/worker/ocibundle.go index f53f520f8e9c..0593daf66891 100644 --- a/pkg/component/worker/ocibundle.go +++ b/pkg/component/worker/ocibundle.go @@ -75,7 +75,7 @@ func (a *OCIBundleReconciler) loadOne(ctx context.Context, fpath string) error { sock, containerd.WithDefaultNamespace("k8s.io"), containerd.WithDefaultPlatform( - platforms.OnlyStrict(platforms.DefaultSpec()), + platforms.Only(platforms.DefaultSpec()), ), ) if err != nil { From 29c7544638bb273a733c15de4f0dadf5963135a1 Mon Sep 17 00:00:00 2001 From: Jussi Nummelin Date: Fri, 24 May 2024 11:56:23 +0300 Subject: [PATCH 2/4] Skip missing blobs in import Signed-off-by: Jussi Nummelin --- pkg/component/worker/ocibundle.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/component/worker/ocibundle.go b/pkg/component/worker/ocibundle.go index 0593daf66891..ca7c8dfe87db 100644 --- a/pkg/component/worker/ocibundle.go +++ b/pkg/component/worker/ocibundle.go @@ -208,7 +208,11 @@ func (a *OCIBundleReconciler) unpackBundle(ctx context.Context, client *containe return fmt.Errorf("can't open bundle file %s: %w", bundlePath, err) } defer r.Close() - images, err := client.Import(ctx, r) + // WithSkipMissing allows us to skip missing blobs + // Without this the importing would fail if the bundle does not images for compatible architectures + // because the image manifest still refers to those. E.g. on arm64 containerd would stil try to unpack arm/v8&arm/v7 + // images but would fail as those are not present on k0s airgap bundles. + images, err := client.Import(ctx, r, containerd.WithSkipMissing()) if err != nil { return fmt.Errorf("can't import bundle: %w", err) } From c2fb3e01548b3a79abbb55c6a159679b4b5013bb Mon Sep 17 00:00:00 2001 From: Jussi Nummelin Date: Fri, 24 May 2024 13:21:30 +0300 Subject: [PATCH 3/4] Update airgap docs relating to multiarch images import Signed-off-by: Jussi Nummelin --- docs/airgap-install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/airgap-install.md b/docs/airgap-install.md index 5d797e84e958..e1773b197fa5 100644 --- a/docs/airgap-install.md +++ b/docs/airgap-install.md @@ -23,7 +23,7 @@ k0s/containerd uses OCI (Open Container Initiative) bundles for airgap installat k0s offers two methods for creating OCI bundles, one using Docker and the other using a previously set up k0s worker. -**Note:** k0s strictly matches image architecture, e.g. arm/v7 images won't work for arm64. +**Note:** When importing the image bundle k0s uses containerd "loose" [platform matching](https://pkg.go.dev/github.com/containerd/containerd/platforms#Only). For arm/v8, it will also match arm/v7, arm/v6 and arm/v5. This means that your bundle can contain multi arch images and the import will be done using platfomr compatibility. ### Docker From e53d0fc86319eea4b6f1bc070ac9bfdc258d6e82 Mon Sep 17 00:00:00 2001 From: Jussi Nummelin Date: Fri, 24 May 2024 14:33:33 +0300 Subject: [PATCH 4/4] Fix typo Co-authored-by: Tom Wieczorek Signed-off-by: Jussi Nummelin --- docs/airgap-install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/airgap-install.md b/docs/airgap-install.md index e1773b197fa5..34313d074e34 100644 --- a/docs/airgap-install.md +++ b/docs/airgap-install.md @@ -23,7 +23,7 @@ k0s/containerd uses OCI (Open Container Initiative) bundles for airgap installat k0s offers two methods for creating OCI bundles, one using Docker and the other using a previously set up k0s worker. -**Note:** When importing the image bundle k0s uses containerd "loose" [platform matching](https://pkg.go.dev/github.com/containerd/containerd/platforms#Only). For arm/v8, it will also match arm/v7, arm/v6 and arm/v5. This means that your bundle can contain multi arch images and the import will be done using platfomr compatibility. +**Note:** When importing the image bundle k0s uses containerd "loose" [platform matching](https://pkg.go.dev/github.com/containerd/containerd/platforms#Only). For arm/v8, it will also match arm/v7, arm/v6 and arm/v5. This means that your bundle can contain multi arch images and the import will be done using platform compatibility. ### Docker