Page MenuHomeFreeBSD

nuageinit: Improvements for nuageinit
ClosedPublic

Authored by dtxdf on Jul 30 2025, 9:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 3:47 AM
Unknown Object (File)
Fri, Oct 10, 11:35 PM
Unknown Object (File)
Fri, Oct 10, 11:35 PM
Unknown Object (File)
Fri, Oct 10, 11:35 PM
Unknown Object (File)
Fri, Oct 10, 5:12 PM
Unknown Object (File)
Fri, Oct 10, 11:57 AM
Unknown Object (File)
Sat, Sep 27, 12:24 AM
Unknown Object (File)
Wed, Sep 24, 1:43 AM
Subscribers

Details

Summary
  • Fix pkg update usage:
    • The function nuage:run_pkg_cmd(...) adds the flag -y, which does not make sense with some commands such as pkg update, causing an error when updating the repository catalogs.
  • Fix typo ssh-authorized-keys -> ssh_authorized_keys in nuageinit(7).
  • Document user ssh_authorized_keys parameter.
  • Use device configuration ID when no match rule is specified:
    • This is the default behavior of cloud-init when no match rule is specified, so the device is configured anyway (even if it does not exist). This greatly simplifies things, since in many cases if_vtnet(4) is used, so there is no need to perform a comparison with the MAC address.
  • Document network parameter:
    • Add example to EXAMPLES section.
  • Set gateway[46] only when addresses is specified:
    • To comply with the cloud-init specification, gateway4 and gateway6 must only take effect when addresses (or static configuration) is specified.
  • Use a separate function to check match rules:
    • This way, we can easily add new logic to new types of rules.
  • Implement network.ethernets.{id}.match.name parameter:
    • But unlike cloud-init, which works with glob expressions (although it depends on the network backend), this implementation takes advantage of Lua pattern-matching expressions.

      Also note that previously we were only concerned with one interface matching, however, to be cloud-init-compliant, we need to configure the matching interfaces (one or more).
  • Set default router only once.
  • Implement network.ethernets.{id}.wakeonlan parameter.
  • Implement network.ethernets.{id}.set-name parameter.
  • Implement network.ethernets.{id}.match.driver parameter:
    • Rename get_ifaces(...) function as get_ifaces_by_mac(...).
    • Add get_ifaces_by_driver(...) function.
  • Implement network.ethernets.{id}.mtu parameter.
  • Implement nameservers parameter.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dtxdf requested review of this revision.Jul 30 2025, 9:23 PM
dtxdf edited the summary of this revision. (Show Details)

2 small remark, which I don't consider as blockers for your code, but imho are worse thinking about for further improvements in particular the part about using resolvconf.

libexec/nuageinit/nuage.lua
480

This could be simplified by using tzsetup(1) ? (I don't think this is a blocker for your code)

libexec/nuageinit/nuageinit
202

This should probably use resolvconf -a which would make it compliant for people using local unbound

This revision is now accepted and ready to land.Jul 31 2025, 7:27 AM
  • Use resolvconf(8) to manipulate resolv.conf(5).
  • Use tzsetup(8) to set time zone.
This revision now requires review to proceed.Jul 31 2025, 5:37 PM
This revision is now accepted and ready to land.Aug 22 2025, 5:22 AM
This revision was automatically updated to reflect the committed changes.

Can this be MFCed to stable at some point?