From b37a34beae7fef6d05331ea73637addca62fa09e Mon Sep 17 00:00:00 2001 From: Oz Tiram Date: Fri, 3 Feb 2023 11:04:02 +0100 Subject: [PATCH] sparkles: custom user bind and ephemeral mounts (#692) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: custom user bind and ephemeral mounts Users can now specify custom and ephemeral mounts in cloud-init under the `install` section, e.g.: ``` users: - name: kairos ... install: auto: true device: "auto" bind_mounts: - /mnt/bind1 - /mnt/bind2 ephemeral_mounts: - /mnt/ephemeral - /mnt/ephemeral2 ... ``` Ephemeral mounts are mounted as RW - but changes are discarded when the machine is restart. Bind mounts will persist changes after restarted. This is a fix for #210 Signed-off-by: Oz Tiram * Add the custom user mount to /cos/run/cos-layout.env Signed-off-by: Oz Tiram * Add docs for custom user mounts in configuration example Signed-off-by: Oz Tiram * Reuse test_install function DRY the code, change how we call the function install_test Signed-off-by: Oz Tiram * Enable custom mount tests and install tests Signed-off-by: Oz Tiram * Enable tests in CI Signed-off-by: Oz Tiram * Remove duplicate if check Signed-off-by: Oz Tiram * Remove uneeded fmt.Println ... Signed-off-by: Oz Tiram * Use separate label for custom mounts Signed-off-by: Oz Tiram * 🔧 Earthfile - DRY ginkgo We repeat this a more than twice so just extract to own target... Signed-off-by: Oz Tiram * Correct return type for ContainElements Signed-off-by: Oz Tiram * Remove CLOUD_INIT from custom mounts test This is not needed here. Signed-off-by: Oz Tiram * Fix qemu-test-* earthly targets Signed-off-by: Oz Tiram * 🔧 Fix CPU passing to VM Signed-off-by: Oz Tiram * 🔧 remove apt cache after install qemu Helps deal with space running out in the CI. Signed-off-by: Oz Tiram * :book: Document custom mounts Signed-off-by: Oz Tiram --------- Signed-off-by: Oz Tiram Co-authored-by: Ettore Di Giacinto --- pkg/config/config.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index b7a111c..f808616 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -23,15 +23,18 @@ import ( const DefaultWebUIListenAddress = ":8080" type Install struct { - Auto bool `yaml:"auto,omitempty"` - Reboot bool `yaml:"reboot,omitempty"` - Device string `yaml:"device,omitempty"` - Poweroff bool `yaml:"poweroff,omitempty"` - GrubOptions map[string]string `yaml:"grub_options,omitempty"` - Bundles Bundles `yaml:"bundles,omitempty"` - Encrypt []string `yaml:"encrypted_partitions,omitempty"` - Env []string `yaml:"env,omitempty"` - Image string `yaml:"image,omitempty"` + Auto bool `yaml:"auto,omitempty"` + Reboot bool `yaml:"reboot,omitempty"` + Device string `yaml:"device,omitempty"` + Poweroff bool `yaml:"poweroff,omitempty"` + GrubOptions map[string]string `yaml:"grub_options,omitempty"` + Bundles Bundles `yaml:"bundles,omitempty"` + Encrypt []string `yaml:"encrypted_partitions,omitempty"` + SkipEncryptCopyPlugins bool `yaml:"skip_copy_kcrypt_plugin,omitempty"` + Env []string `yaml:"env,omitempty"` + Image string `yaml:"image,omitempty"` + EphemeralMounts []string `yaml:"ephemeral_mounts,omitempty"` + BindMounts []string `yaml:"bind_mounts,omitempty"` } type Config struct {