Skip to content

Commit

Permalink
Merge pull request #4484 from ncopa/ocibundle-armv7
Browse files Browse the repository at this point in the history
Fix ocibundle for 32bit arm
  • Loading branch information
twz123 authored May 28, 2024
2 parents ce54bab + e53d0fc commit fa5e96c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/airgap-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 platform compatibility.

### Docker

Expand Down
8 changes: 6 additions & 2 deletions pkg/component/worker/ocibundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit fa5e96c

Please sign in to comment.