Refactor ignition support during dracut

- Control root device using the node/profile root field
- Add support for `/warewulf/wwinit.d` to run scripts during first stage
- Move first-stage ignition support to `/warewulf/wwinit.d/`
- Add `wwctl <node|profile> set --parttype`
- Add overlay template functions `SystemdEscape` and `SystemdEscapePath`
- Support configuring ignition with resources

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-06-30 23:09:49 -06:00
parent 608ef89d40
commit b98eae4b01
29 changed files with 787 additions and 354 deletions

View File

@@ -192,8 +192,15 @@ In particular:
- Update PAM configuration to allow missing shadow entries
- Relabel the file system for SELinux
Other overlays may place additional scripts in ``/warewulf/init.d/`` to affect
node configuration in this pre-boot environment.
Other overlays can place scripts in one of two locations for additional pre-init
provisioning actions:
- **/warewulf/wwinit.d/:** executed in the initial root final system before the
image is loaded into its final location. In a two-stage boot, these scripts
are executed in the Dracut initramfs.
- **/warewulf/init.d/:** executed in the final root file system but before
calling ``init``.
wwclient
--------
@@ -309,6 +316,36 @@ ignition
--------
The **ignition** overlay defines partitions and file systems on local disks.
Configuration may be provided via native disk, partition, and filesystem fields
or via an ``ignition`` resource.
.. code-block:: yaml
ignition:
storage:
disks:
- device: /dev/vda
partitions:
- label: scratch
shouldExist: true
wipePartitionEntry: true
wipeTable: true
filesystems:
- device: /dev/disk/by-partlabel/scratch
format: btrfs
path: /scratch
wipeFilesystem: false
If any disk/partition/filesystem configuration is provided for a node with
explicit arguments to ``wwctl <node|profile> set``, the ``ignition`` resource is
ignored.
To use ignition during Dracut (so that the root file system may be provisioned
before the image is loaded) include Ignition in the Dracut image.
.. code-block:: shell
wwctl image exec rockylinux-9 -- /usr/bin/dracut --force --no-hostonly --add wwinit --add ignition --regenerate-all
debug
-----

View File

@@ -148,7 +148,13 @@ symlink.
IgnitionJson
------------
Generates JSON suitable for use by Ignition to create
Generates JSON suitable for use by Ignition to create partitions and file
systems, from the data stored in a node's native ``disks`` and ``filesystems``
fields.
.. code-block::
{{ IgnitionJson }}
abort
-----
@@ -174,10 +180,9 @@ nobackup
UniqueField
-----------
UniqueField returns a filtered version of a multi-line input string. input is
expected to be a field-separated format with one record per line (terminated by
`\n`). Order of lines is preserved, with the first matching line taking
precedence.
Returns a filtered version of a multi-line input string. input is expected to be
a field-separated format with one record per line (terminated by `\n`). Order of
lines is preserved, with the first matching line taking precedence.
For example, the following template snippet has been used in the ``syncuser`` overlay
to generate a combined ``/etc/passwd``.
@@ -191,6 +196,24 @@ to generate a combined ``/etc/passwd``.
| UniqueField ":" 0 | trim
}}
SystemdEscape
-------------
Escapes a string for use in a systemd unit file.
Escape rules are documented at `systemd.unit. <https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#String%20Escaping%20for%20Inclusion%20in%20Unit%20Names>`_
SystemdEscapePath
-----------------
Escapes a path for use in a systemd unit file.
.. code-block::
{{ file (print ($fs.path | SystemdEscapePath) ".mount") }}
Escape rules are documented at `systemd.unit. <https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#String%20Escaping%20for%20Inclusion%20in%20Unit%20Names>`_
Examples
========