kairos-io / kairos

The immutable Linux meta-distribution for edge Kubernetes.
https://kairos.io
Apache License 2.0
1.17k stars 96 forks source link

feat: document merging mechanism for cloud configs #2737

Closed mauromorales closed 2 months ago

mauromorales commented 4 months ago

relates to #2735 but also include all other cases for merging so it is clear for the user what will happen

jimmykarily commented 4 months ago

One solution would be to allow the users to run a kairos-agent command and see how multiple files are combined in one. Maybe this is already possible. Let's check.

jimmykarily commented 2 months ago

There is already this: kairos-agent config which prints out the merged configs.

One "strange" thing, in my test it had a top level key:

name: RPI configs

which comes from here and it probably just happens to be the last one that was merged (?)(thought the order of file indicates that others should have taken precedence). In any case, it's weird that we set the same top level key in all our cloud init files.

jimmykarily commented 2 months ago

kairos-agent config skips most of the overlay files because of missing header:

warning: skipping /system/oem/00_datasource.yaml because it has no valid header
warning: skipping /system/oem/00_home_dir_owner_fix.yaml because it has no valid header
warning: skipping /system/oem/00_rootfs.yaml because it has no valid header
warning: skipping /system/oem/00_rootfs_uki.yaml because it has no valid header
warning: skipping /system/oem/02_agent.yaml because it has no valid header
warning: skipping /system/oem/02_notify.yaml because it has no valid header
warning: skipping /system/oem/03-setupcon.yaml because it has no valid header
warning: skipping /system/oem/05_network.yaml because it has no valid header
warning: skipping /system/oem/08_grub.yaml because it has no valid header
warning: skipping /system/oem/09_openrc_services.yaml because it has no valid header
warning: skipping /system/oem/09_systemd_services.yaml because it has no valid header
warning: skipping /system/oem/10_accounting.yaml because it has no valid header
warning: skipping /system/oem/12_nvidia.yaml because it has no valid header
warning: skipping /system/oem/21_kcrypt.yaml because it has no valid header
warning: skipping /system/oem/23_c3os.yaml because it has no valid header
warning: skipping /system/oem/25_autologin.yaml because it has no valid header
warning: skipping /system/oem/26_selinux.yaml because it has no valid header
warning: skipping /system/oem/26_vm.yaml because it has no valid header
warning: skipping /system/oem/29_blacklist.yaml because it has no valid header
warning: skipping /system/oem/30_ulimit.yaml because it has no valid header
warning: skipping /system/oem/31_hosts.yaml because it has no valid header
warning: skipping /system/oem/32_profile.yaml because it has no valid header
warning: skipping /system/oem/50_recovery.yaml because it has no valid header
warning: skipping /system/oem/51_reset.yaml because it has no valid header
warning: skipping /system/oem/52_installer.yaml because it has no valid header
warning: skipping /system/oem/99_sysext.yaml because it has no valid header

We just don't see it because we pass o.NoLogs

I'm trying to add some code to keep track of what files have been merged and somehow show it in this command. They come with a filepath and a name: field which can be very useful to maybe create a tree of things that have been merged into the final config.

jimmykarily commented 2 months ago

Done through: