refactor: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.
[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* ⬆️ Bump Kairos repositories
Signed-off-by: Ettore Di Giacinto <mudler@mocaccino.org>
* 🐧 Find out which grub to call
Signed-off-by: Ettore Di Giacinto <mudler@mocaccino.org>
Signed-off-by: Ettore Di Giacinto <mudler@mocaccino.org>
* ✨ Add state api
This is related to https://github.com/kairos-io/kairos/issues/34.
Starts to unify the API to retrieve the state in the sdk to have a common place to query system status information.
* 🤖 Add test
* Update go.mod
* ⚙️ Fine-tune detection of partitions
* 🤖 Add more fine-grained tests
* 🎨 Add /dev/ to partition name
* 🤖 Fixup tests
* ⚙️ Remount accessors
* ✨ Add state partition to cloud-init paths
* 📝 Upper case Kairos in motd
* 🎨 Add mounts sdk
* 🎨 Set grub options via SDK
* 🎨 Make it more idiomatic
* 🤖 Add bundles and sysext test
* ✨ Exec bundles also after install
* 🤖 Adapt tests
* 🎨 Create dir only if doesn't exist
* 🎨 Return err on mount
* 🎨 Make bundle errors failure as an option
* 🎨 Minor fixups
* debug
* 🤖 Fix spec
* 🤖 Get correct version for bundle test
* 🎨 Fixups
* 🤖 systemd-sysext is available only on opensuse for now
From now on images built from this repo are the c3os core images.
c3os core images contains only the base image, framework files and the c3os agent.
This also sets up tests accordingly to run only to cover the c3os-agent.
This had some side effects:
- Have to add some utils from the kairos/machine modules, which IMHO
should not be there, they should be here if the are generic enough
- Dropping the sdk dir, just have the modules in the root dir
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* ⚠️🎨✨ Use immucore
Build kairos with immmucore instead of cos-immutable-rootfs
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* 🐛 Fix state sdk
State sdk is using ghw to identify the state of the disks, but
unfortunately ghw only works with devices and not with labels
This patch adds a workaround by checking deeper for partitions that
migth not have mountpoints reported by ghw but are indeed mounted
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* 🐛 Fix state not catching netboot properly
This worked with the old cos-immutable-rootfs due to the rd.cos.disable
stanza in cmdline making the livecd cloud config file trigger, which
created the livecd sentinel file.
With immucore, the sentinel is being created during initramfs directly
so we need to rely on the cmdline to identify it.
State sdk should know that having the netboot stanza should identify the
boot as cdlive
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* Fix custom binds set as RW_PATHS
RW_PATHS are meant for overlay dirs which go away after a reboot.
Custom binds/binds are mounted under COS_PERSISTENT, so they persist
after reboot AND are RW by default.
This patch removes adding the custom binds into the RW_PATHS on the
cos-layout file as that can lead to unintended consequences
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* Dont run custom mounts on livecd and recovery
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* Rework writing custom ephemeral/binds
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* Maybe fix tests
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* Add missing sgdisk to ubuntu images
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
* 🐛 Backport dracut patch for ubuntu 20 iscsi
There was an issue with dracut 48 in which the iscsid.socket required fs
targets to be ready. On an iso this could lead to a dependency cycle
between the dmsquash module setting up the livecd rootfs and the iscsi
socket required the initrd-fs to be ready.
This was fixed on dracut 50 and its what this patch brings, dropping the
socket dependency on the fs target so it can break the dependency cycle.
This only affect ubuntu 20 lts, and only affects booting from the iso.
Alos the issue is random as systemd will decide to break the dependency
in a non predictable way by disabling one of the services that conflict,
so sometimes it would be the iscsi serviec, which would make the iso
boot but sometimes it could be other more important services liek teh
local fs or the dracut pre-mount services.
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
(cherry picked from commit 63f0c75d69ab3adca143f917c2e31b75ca3d96c7)
* Bump immucore
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
---------
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
* 🌱 Detect more information about runtime
This introduces a `system` and a `kairos` block available in
kairos-agent get state.
This allows for instance to query the agent for the kairos version as
such:
`kairos-agent get state kairos.version`
Part of #755
Signed-off-by: mudler <mudler@c3os.io>
* 🤖 Fixup tests
Signed-off-by: mudler <mudler@c3os.io>
---------
Signed-off-by: mudler <mudler@c3os.io>