metropolis: use new OS image format for install
This switches the USB and SSH installation methods to the new OS image
format based on OCI artifacts.
When stored on disk, the new format consists of a directory containing
an OCI layout, instead of a single file. This means that all steps which
copy or upload an image now need to handle a tree of files.
Change-Id: I526d32f5c50bd74f513f785118768a56b2655fa0
Reviewed-on: https://review.monogon.dev/c/monogon/+/4090
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/core/BUILD.bazel b/metropolis/cli/metroctl/core/BUILD.bazel
index 73527d5..cd95ac1 100644
--- a/metropolis/cli/metroctl/core/BUILD.bazel
+++ b/metropolis/cli/metroctl/core/BUILD.bazel
@@ -21,6 +21,7 @@
"//osbase/blockdev",
"//osbase/fat32",
"//osbase/gpt",
+ "//osbase/oci",
"//osbase/structfs",
"@io_k8s_client_go//pkg/apis/clientauthentication/v1:clientauthentication",
"@io_k8s_client_go//tools/clientcmd",
diff --git a/metropolis/cli/metroctl/core/install.go b/metropolis/cli/metroctl/core/install.go
index 5d43a89..92e8303 100644
--- a/metropolis/cli/metroctl/core/install.go
+++ b/metropolis/cli/metroctl/core/install.go
@@ -15,6 +15,7 @@
"source.monogon.dev/osbase/blockdev"
"source.monogon.dev/osbase/fat32"
"source.monogon.dev/osbase/gpt"
+ "source.monogon.dev/osbase/oci"
"source.monogon.dev/osbase/structfs"
)
@@ -28,13 +29,13 @@
// Optional NodeParameters to be embedded for use by the installer.
NodeParams *api.NodeParameters
- // Optional Reader for a Metropolis bundle for use by the installer.
- Bundle structfs.Blob
+ // Optional OS image for use by the installer.
+ Image *oci.Image
}
// MakeInstallerImage generates an installer disk image containing a Table
// partition table and a single FAT32 partition with an installer and optionally
-// with a bundle and/or Node Parameters.
+// with an OS image and/or Node Parameters.
func MakeInstallerImage(args MakeInstallerImageArgs) error {
if args.Installer == nil {
return errors.New("installer is mandatory")
@@ -58,8 +59,12 @@
return err
}
}
- if args.Bundle != nil {
- if err := espRoot.PlaceFile("metropolis-installer/bundle.bin", args.Bundle); err != nil {
+ if args.Image != nil {
+ imageLayout, err := oci.CreateLayout(args.Image)
+ if err != nil {
+ return err
+ }
+ if err := espRoot.PlaceDir("metropolis-installer/osimage", imageLayout); err != nil {
return err
}
}