Page MenuHomeFreeBSD

cloudinit: add basic support for cloudinit.
Changes PlannedPublic

Authored by bapt on Wed, Nov 23, 7:06 PM.

Details

Summary

this is a very early script to support cloudinit, it does not intend to
be a full featured cloudinit client, but will support a good enough
subset to be viable in most case.

The vert alpha implementation is able to support cloud-init with a
config drive gpt labelled config-drive as done by OVHCloud to boot
its baremetal cloud product.

It supports ipv4 (only dhcp so far), ipv6 (only static) adding ssh keys
to the default user (creating the default user as 'freebsd'

With this one is able to use the 'bring your own image feature" out of
box.

The only missing part for full OVHCloud bare metal support is executing
the provided user_data, this will come later.

It is expected that the script grows the support of other clouds
supporting cloud-init, contributions are welcomed.

It is designed to be only run once via the firstboot mecanism.

Sponsored by: OVHCloud

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 48502
Build 45388: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Wed, Nov 23, 7:06 PM

This is actually done in my free time

CC @me_igalic.co who is doing some cloud-init work. Maybe there is some overlap or potential for collaboration.

with my cloud-init contributor hat on: I like the basic idea of this, because it can live in base.
The big caveat is that this only provides, probably: can only provide, the most basic functionality seen here.
Everything that cloud-init handles in modules, might end up being too much work to keep up with upstream.

This thing will need a man page, that documents the exact functionality/limitations.

libexec/simplecloudinit/simplecloudinit
70 ↗(On Diff #113450)

why is this reinstantiated?

101 ↗(On Diff #113450)

what if what we write here conflicts with what's already in /etc/rc.conf?

with my cloud-init contributor hat on: I like the basic idea of this, because it can live in base.
The big caveat is that this only provides, probably: can only provide, the most basic functionality seen here.
Everything that cloud-init handles in modules, might end up being too much work to keep up with upstream.

This thing will need a man page, that documents the exact functionality/limitations.

yes as stated in the commit log, it will never be a full featured cloudinit, just good enough for basic usage, manpage will follow, once the scope of simplecloudinit will have settled a little bit.

There is no overlap here, with full cloudinit.

libexec/simplecloudinit/simplecloudinit
70 ↗(On Diff #113450)

because we need a new parser.

101 ↗(On Diff #113450)

rc.conf.d wins.
Keep in mind this is a a firstboot only thing, rc.conf should be empty or almost empty anyway.

chown .ssh directory to ensure it belongs to the "freebsd" user

Fix typo in freebsd's home directory name

Write netif configuration into network, otherwise the ipv4 config
is not taken in account
For static ipv6 do not accept rt advertising
Remove hardcoded prefixlen for ipv6
Ensure sshd is enabled.

make the rc script more generic respecting the cloudinit specification
the config drive should be either in ec2 or openstack directory
in a drive formatted in iso9660 or vfat labellized "config-2"

Amend commit log now that we find the drive in a standard way

libexec/rc/rc.d/simplecloudinit
23 ↗(On Diff #113488)

s/labelized/labeled/

bapt marked an inline comment as done.Thu, Nov 24, 2:58 PM

Rename nuageinit to avoid collision with cloudinit

Document the fact it is a limited cloudinit implementation

deal with rename fallouts

libexec/Makefile
116

case error - NUAGE?

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Nov 25, 7:51 AM
This revision was automatically updated to reflect the committed changes.
bapt marked an inline comment as done.Fri, Nov 25, 8:02 AM
bapt planned changes to this revision.Fri, Nov 25, 1:50 PM

will work on adding nocloud support and userdata (only cloud-config for now)

libexec/rc/rc.d/nuageinit
26

I'm not fully understanding when this /dev/msdosfs/* appears.

  • when I plug in a Kindle, I see /dev/msdosfs/Kindle
  • when /boot/efi is umnounted, there's no /dev/msdosfs present, even though

fstyp /dev/gpt/efiboot = msdos

According to cloudinit spec an EFI partition with either ec2 or openstack files in it should also be acceptable.

bapt does this sound ok for you?

the main advantage here is that we don't need to change how we build official FreeBSD images, and they can be trivially amended to include cloudinit parameters.

the code would need to accommodate /boot/efi and not just /media/cloudinit though.

libexec/rc/rc.d/nuageinit
26

/dev/msdosfs appears when the system tastes a geom provider with a FAT filesystem that has a label in the FAT filesystem. Perhaps your /dev/gpt/efiboot filesystem is missing this.