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

@@ -31,10 +31,7 @@ smbios --type 3 --get-string 8 --set assetkey
uri="(http,{{.Ipaddr}}:{{.Port}})/provision/${net_default_mac}?assetkey=${assetkey}"
kernel="${uri}&stage=kernel"
{{- $defentry := "singlestage" }}
{{- if eq .Root "persistent"}}{{ $defentry = "dracut" }}{{ end }}
{{- if .Tags.GrubMenuEntry }}{{ $defentry = .Tags.GrubMenuEntry }}{{ end }}
set default={{ $defentry}}
set default={{ or .Tags.GrubMenuEntry "single-stage" }}
set timeout=2
menuentry "Single-stage boot" --id single-stage {
@@ -117,13 +114,15 @@ menuentry "Single-stage boot (no compression)" --id single-stage-nocompress {
echo "!! Unable to load images."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Booting..."
boot
}
menuentry "Two stage boot with dracut {{ if eq .Root "persistent"}}(persistent){{ end }}" --id dracut {
menuentry "Two stage boot with dracut" --id dracut {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
@@ -143,18 +142,11 @@ menuentry "Two stage boot with dracut {{ if eq .Root "persistent"}}(persistent){
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}"
net_args="rd.neednet=1 {{range $devname, $netdev := .NetDevs}}{{if and $netdev.Hwaddr $netdev.Device}} ifname={{$netdev.Device}}:{{$netdev.Hwaddr}} {{end}}{{end}}"
{{- if eq .Root "persistent"}}
ignition_args="wwinit.ignition=http://{{.Ipaddr}}:{{.Port}}/overlay-file/persistent wwinit.imagename={{ .ImageName }} wwinit.id={{ .Id }} wwinit.ip={{ .Ipaddr }}"
root="persistent"
echo "* Persistent install"
{{- else }}
root="wwinit"
{{- end }}
wwinit_args="root=$root wwinit.uri=${wwinit_uri} init=/init"
wwinit_args="root=wwinit:{{default "tmpfs" .Root}} wwinit.uri=${wwinit_uri} init=/warewulf/run-init"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}} $net_args $wwinit_args $ignition_args
linux $kernel wwid=${net_default_mac} {{.KernelArgs}} $net_args $wwinit_args
if [ $? != 0 ]
then
echo "!!"