=== FreeBSD as a Tier 1 cloud-init Platform

Links: +
link:https://cloud-init.io/[cloud-init Website] URL: link:https://cloud-init.io/[] +
link:https://cloudinit.readthedocs.io/en/latest/[cloud-init Documentation] URL: link:https://cloudinit.readthedocs.io/en/latest/[] +

Contact: Mina Galić <freebsd@igalic.co>

cloud-init is the standard way of provisioning servers in the cloud.
Over the past year and a half, thanks to this FreeBSD support has steadily improved.
This year, together with cloud-init developers and the FreeBSD Foundation, we decided to explicitly focus on making improvements in FreeBSD itself, that will aid the cloud-init team to test future changes to FreeBSD code-paths themselves.
To achieve this goal, I need to make FreeBSD run in LXD (and Incus), under the control of ``lxd-agent`` (or ``incus-agent``).

Here are some improvements from the recent weeks:

- I have written a small link:https://codeberg.org/meena/test-cloud-init[testing-framework] (in sh, and I'm slowly porting it to OpenTofu/Terraform), which installs the latest version of package:net/cloud-init-devel[] or package:net/cloud-init[] and runs a couple of standard cloud-init tests.
- To do this, I have created a link:https://pkg.igalic.co/[dedicated public repository] which contains the latest versions of package:net/cloud-init-devel[] and package:net/cloud-init[] for FreeBSD 13 and 14 on amd64 and aarch64.
- I have link:https://codeberg.org/meena/vsock-tests[ported Linux's vsock testing framework to FreeBSD]
- I created a driver skeleton for a link:https://codeberg.org/meena/freebsd-src/src/branch/vsock/sys/dev/virtio/socket[VirtIO Socket driver], based on the HyperV Socket driver.
- In doing so, I made numerous link:https://reviews.freebsd.org/D44517[improvements to HyperV sockets], some of which are accepted, others still need more work.
- I have tested and released the latest 24.1 series cloud-init, where the cloud-init team and I have finally fixed some longstanding bugs, such as link:https://github.com/canonical/cloud-init/pull/4820[moving ``/run/cloud-init``] to [.filename]#/var/run/cloud-init# on BSD, as well as fixing the link:https://github.com/canonical/cloud-init/pull/5061[``homedir`` argument] to ``user_groups`` to actually do something.
- This release also sees numerous fixes to the OpenBSD code-paths from the community and not just me.
- I have also started an official port for OpenBSD, but link:https://marc.info/?l=openbsd-ports&m=170508174230708&w=2[that work has stalled].

The work to come, in broad strokes:

- Finish the FreeBSD VirtIO Socket driver.
- Fix Go's runtime to support VirtIO on FreeBSD.
- Port lxd-agent's dependencies to FreeBSD.
- Port lxd-agent to FreeBSD.

That work will be interspersed with more improvements to cloud-init on BSDs, and more tests on different cloud providers.

Sponsor: The FreeBSD Foundation
