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

@@ -14,6 +14,7 @@ import (
"text/template"
"github.com/Masterminds/sprig/v3"
"github.com/coreos/go-systemd/v22/unit"
"github.com/warewulf/warewulf/internal/pkg/config"
"github.com/warewulf/warewulf/internal/pkg/node"
@@ -496,12 +497,7 @@ func RenderTemplateFile(fileName string, data TemplateStruct) (
"softlink": softlink,
"readlink": filepath.EvalSymlinks,
"IgnitionJson": func() string {
str := createIgnitionJson(data.ThisNode)
if str != "" {
return str
}
writeFile = false
return ""
return createIgnitionJson(data.ThisNode)
},
"abort": func() string {
wwlog.Debug("abort file called in %s", fileName)
@@ -513,7 +509,9 @@ func RenderTemplateFile(fileName string, data TemplateStruct) (
backupFile = false
return ""
},
"UniqueField": UniqueField,
"UniqueField": UniqueField,
"SystemdEscape": unit.UnitNameEscape,
"SystemdEscapePath": unit.UnitNamePathEscape,
}
// Merge sprig.FuncMap with our FuncMap