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:
@@ -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
|
||||
-----
|
||||
|
||||
@@ -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
|
||||
========
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ For example, the ``imgextract`` command can be `explicitly enabled`_.
|
||||
support for ZLIB and GZIP archive image formats.
|
||||
|
||||
Configuring Warewulf (>= v4.5.0)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In Warewulf v4.5.0, Warewulf can be configured to use these files using the
|
||||
``tftp.ipxe`` and ``paths.ipxesource`` configuration parameters in
|
||||
@@ -321,8 +321,8 @@ directly from the node's assigned image.
|
||||
|
||||
.. _booting with dracut:
|
||||
|
||||
Booting with dracut
|
||||
===================
|
||||
Two-stage boot: dracut
|
||||
======================
|
||||
|
||||
Some systems, typically due to limitations in their BIOS or EFI firmware, are
|
||||
unable to load image of a certain size directly with a traditional bootloader,
|
||||
@@ -337,21 +337,15 @@ must be installed in the image.
|
||||
With the ``warewulf-dracut`` package installed in the image, you can then build
|
||||
an initramfs inside the image.
|
||||
|
||||
EL installation
|
||||
---------------
|
||||
.. code-block:: shell
|
||||
|
||||
# Enterprise Linux
|
||||
wwctl image exec rockylinux-9 --build=false -- /usr/bin/dnf -y install https://github.com/warewulf/warewulf/releases/download/v4.6.1/warewulf-dracut-4.6.1-1.el9.noarch.rpm
|
||||
wwctl image exec rockylinux-9 -- /usr/bin/dracut --force --no-hostonly --add wwinit --regenerate-all
|
||||
|
||||
|
||||
SUSE installation
|
||||
-----------------
|
||||
.. code-block:: shell
|
||||
|
||||
zypper -y install warewulf-dracut
|
||||
dracut --force --no-hostonly --add wwinit --regenerate-all
|
||||
|
||||
# SUSE
|
||||
wwctl image exec leap-15 --build=false -- /usr/bin/zypper -y install https://github.com/warewulf/warewulf/releases/download/v4.6.1/warewulf-dracut-4.6.1-1.suse.lp155.noarch.rpm
|
||||
wwctl image exec leap-15 -- /usr/bin/dracut --force --no-hostonly --add wwinit --regenerate-all
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -403,42 +397,70 @@ to 50% of physical memory. This size limit may be adjusted using the kernel
|
||||
argument `wwinit.tmpfs.size`. (This parameter is passed to the `size` option
|
||||
during tmpfs mount. See ``tmpfs(5)`` for more details.)
|
||||
|
||||
Persistent installation
|
||||
========================
|
||||
With the `dracut` installation enabled warewulf can also install
|
||||
the node image to a harddrive. On the first boot of the node the
|
||||
compressed node image is simply dumped onto the configured partition.
|
||||
.. _provision to disk:
|
||||
|
||||
Provision to disk
|
||||
=================
|
||||
|
||||
*New in Warewulf v4.6.2*
|
||||
|
||||
As a tech preview, the Warewulf two-stage boot process can provision the node
|
||||
image to local storage.
|
||||
|
||||
.. warning::
|
||||
warewulf doesn't install the bootloader to the disk and add UEFI
|
||||
entries. In order to boot the node network booting is required and
|
||||
at every boot the kernel and the initrd is transfered over the network.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
This functionality is a technology preview and should be used with care. Pay
|
||||
specific attention to ``wipeFilesytem`` (ignition) and ``overwrite`` (mkfs)
|
||||
settings.
|
||||
|
||||
The node image will be installed to the partition called `rootfs`. You
|
||||
can add add a rootfs with e.g. following command
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl node set n01 \
|
||||
--diskname /dev/vda --diskwipe \
|
||||
--partname rootfs --partcreate --partnumber 1 \
|
||||
--fsname rootfs --fsformat ext4 --fspath /rootfs
|
||||
|
||||
Now the node boot method has to be set to persitent with following command
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl node set n01 --root persistent
|
||||
|
||||
and the node rebooted.
|
||||
|
||||
.. note::
|
||||
|
||||
If the boot mode is perisiten the configured partion labeled `rootfs` will
|
||||
be mounted as `/`. With any other boot method mount point confiured (here `/roofs`)
|
||||
will be used.
|
||||
Warewulf doesn't install a bootloader to the disk or add UEFI entries. Nodes
|
||||
still request an image and configuration from the Warewulf server on every
|
||||
boot.
|
||||
|
||||
.. note::
|
||||
|
||||
While provisioning to disk should be possible during a single-stage boot, not
|
||||
all features are available:
|
||||
|
||||
- Warewulf does not perform hardware detection to ensure that necessary
|
||||
kernel modules are loaded prior to init.
|
||||
- Warewulf does not load udev to ensure that ``/dev/disk/by-*`` symlinks are
|
||||
available prior to init.
|
||||
|
||||
With Ignition
|
||||
-------------
|
||||
|
||||
Warewulf needs a prepared file system to deploy the image to. Warewulf can
|
||||
provision this file system using Ignition. To use Ignition, include ``ignition``
|
||||
in your system overlay. The ignition overlay provisions disks during init and,
|
||||
optionally, during the first stage of a two-stage boot. This allows the
|
||||
root file system to be provisioned before the image is loaded.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl node set wwnode1 \
|
||||
--diskname /dev/vda --diskwipe \
|
||||
--partname rootfs --partcreate --partnumber 1 \
|
||||
--fsname rootfs --fsformat ext4 --fspath /
|
||||
|
||||
In order to allow Dracut to provision the disk, partition, and file system,
|
||||
Ignition must be included in the Dracut image.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl image exec rockylinux-9 -- /usr/bin/dracut --force --no-hostonly --add wwinit --add ignition --regenerate-all
|
||||
|
||||
The necessary file system may alternatively be prepared out-of-band.
|
||||
|
||||
|
||||
Configuring the root device
|
||||
---------------------------
|
||||
|
||||
Set the desired storage device for the node image using the ``--root``
|
||||
parameter.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
wwctl node set wwnode1 --root /dev/disk/by-partlabel/rootfs
|
||||
|
||||
Reference in New Issue
Block a user