Commit Graph

350 Commits

Author SHA1 Message Date
Jonathon Anderson
9e526c23fc Audit and correct documentation, cobra help text, and log messages for accuracy
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2026-03-18 16:58:39 -06:00
Jonathon Anderson
081d2ec61e Update linter for golang v1.25 compatibility
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2026-03-11 09:32:49 +01:00
Jonathon Anderson
9a3533237f Address snyk and dependabot issues
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2026-03-11 09:29:45 +01:00
jason scott
8397947d3d Adjusting profile comment field so that it's not inherited by nodes 2026-02-23 15:00:25 -07:00
Christian Goll
a0efd7fe08 Added --partwipe flag for set 2026-01-21 10:38:47 +01:00
Hyacinthe Cartiaux
aad03b7cd6 Fix a typo in ipmiwrite comment 2026-01-07 23:51:11 +01:00
Jonathon Anderson
4e67db0be6 Reflection-based template walking
Rather than deriving the identity of template variables by string parsing the
name, identify its relationship to the underlying struct using reflection.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-12-09 23:16:00 -07:00
Christian Goll
68758e3e45 use comments of variables for help 2025-12-09 22:52:44 -07:00
Timothy Middelkoop
4f58845a9e Add IPv6 support for Dnsmasq and NetworkManager
Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
2025-11-27 01:56:18 +00:00
Jonathon Anderson
92375f4ebb Explicit field names
Fields now use the value of a `name` tag on a struct to determine the display
name for a given field. This improves output for boolean-pointer fields, which
otherwise have a P suffix and helper methods to retain backwards-compatibility.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-09-05 14:08:24 -06:00
Jonathon Anderson
59f187bf5e Convert disk booleans from wwbool to *bool
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-09-05 14:16:03 +02:00
Christian Goll
d5b94afcb9 replace bools in disk structures with wwBool 2025-09-05 14:16:03 +02:00
Christian Goll
2e860c3462 changed SetId() to setId() 2025-07-02 13:51:07 +02:00
Jonathon Anderson
b98eae4b01 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>
2025-06-30 23:19:31 -06:00
Jonathon Anderson
4005afac4c Add a new OpenAPI v3 REST API to warewulfd at /api
Co-authored-by: jason yang <jasonyangshadow@gmail.com>

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-04-03 07:12:03 -06:00
Jonathon Anderson
09488db3f6 Fix processing of UNDEF and UNSET during wwctl <node|profile> set. #1837
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-03-25 18:16:14 -06:00
Jonathon Anderson
3919dea887 Fix display of dotted field names
- Fixes: #1825

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-03-19 02:59:47 -06:00
Jonathon Anderson
fd8de8bfab Add WWbool.BoolDefaultTrue()
New support in WWbool for booleans that default "true."

Used primarily for NetDev.OnBoot.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-20 01:41:10 -07:00
Jonathon Anderson
f71483035b Updated overlay flags
New flags: `wwctl <node|profile> <add|set> [--runtime-overlays|--system-overlays]`.

Previous flags retained hidden for backwards-compatibility.

- Closes: #1495

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-10 19:17:08 -07:00
Jonathon Anderson
87da57d1a2 Return "" when NetDev.IpCIDR is empty
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-10 10:26:01 +01:00
Jonathon Anderson
690eedc247 Remove support for regex in node and profile argument lists
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-07 22:19:59 -07:00
Jonathon Anderson
6bfcfc5fda Prevent merging of zero-value net.IP fields
- Fixes: #1710

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-06 16:43:21 -07:00
Jonathon Anderson
e3d90cd323 Prefer parent profile values over child profile values.
- Fixes: #1672

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-03 12:16:12 +01:00
Jonathon Anderson
032db29f87 Don't populate NetDevs[].Type or NetDevs[].Netmask during upgrade
- Closes: #1661

NetDev defaults don't behave quite the same as standard fields, because they
need to be set per-device. Meanwhile, trying to set a value may erroneously
override values that are on the default profile.

Switch this to a warning rather than attempting to take explicit action.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-03 11:00:12 +01:00
Jonathon Anderson
f931eb6a0a Fixed negation for slice field elements during profile/node merge
- Fixes: #1677

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-01 13:32:10 +01:00
Jonathon Anderson
51f61f93c4 Refactor kernel args as a slice
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-21 09:52:58 -07:00
Jonathon Anderson
73a8ef8e0e Refactor wwctl <node|profile> edit and fix bugs
`wwctl node edit` appears to not be working properly since MergeNode. This
refactor, partly towards #918, resolves the issues with `node edit` and updates
`profile edit` to match.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 13:02:18 -07:00
Jonathon Anderson
a8fab3e844 Enhancements for node.Field formatting
- Complex values are now marshalled as json
- Booleans are now represented as truth values

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 12:55:19 -07:00
Jonathon Anderson
d6d1e37c83 Merge pull request #1641 from anderbubble/rename-container-node-image
Rename "container" to "image"
2025-01-23 21:45:41 -07:00
Xu YANG
55c2f155b3 Merge pull request #1644 from anderbubble/vscode-recommendations
Linting fixes called-out by vscode
2025-01-24 08:55:47 +09:00
Jonathon Anderson
45a690ca4e Rename "container" to "image"
- Updated `wwctl upgrade` to handle updates
- Maintained `.Container` and `.ContainerName` in tstruct
- Added `ContainerName()` methods to node and profile objects
- Added `--container`, `-C` aliases to wwctl commands (`<node|profile> <add|set>`)
- Added `wwctl container` alias
- Added support for `container_exit.sh` if `image_exit.sh` is not found

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 05:54:19 -07:00
Jonathon Anderson
4be3e6db9f Linting fixes called-out by vscode
A few linting issues that were called out by vscode.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 05:26:43 -07:00
Jonathon Anderson
57d28c5bc9 Expand nodes when rendering overlay templates
Before #1628, all default constructors for nodes and profiles attempted to
construct objects with pre-populated empty fields (e.g., for pointers to member
structs and for collections that default to nil). Changes to MergeNode in #1629
changed this behavior intentionally to simplify the generation of minimal json;
but this had the unintended side-effect of breaking existing templates that may
now encounter a nil pointer, particularly when accessing member structs.

Introduced here, the Expand() methods on Node and Profile are now responsible
for populating such fields, and Node.Expand() is now called during template
processing.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 04:26:01 -07:00
Jonathon Anderson
c06f558cf4 fixup! Use Node literal in MergeNode, not EmptyNode()
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 10:12:08 -07:00
Jonathon Anderson
b50fb3f3ef Fix handling of net.IP during node merge
Because net.IP is derived from []byte, it was being handled by mergo as a
slice. This adds an additional transformer that handles net.IP specifically,
and also watches for this type in field tracking.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 10:07:19 -07:00
Jonathon Anderson
dae8d004b3 Use Node literal in MergeNode, not EmptyNode()
EmptyNode populates empty sub-structs, which interferes with omitempty during
serialization.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 09:48:26 -07:00
Jonathon Anderson
f0e634183e Consolidate MergeNode merge behavior to an inner merge function
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 09:47:45 -07:00
Jonathon Anderson
e478adc45d Add InterfaceTransformer{} to a Merge call that omitted it
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-18 07:33:11 -07:00
Jonathon Anderson
bc52f3b7d7 Recommended changes from review of #1568
- Make Resources an `interface{}` to support arbitrary yaml
- Remove `wwctl resource` as incompatible with arbitrary yaml
- Revert changes to host overlay templates
- Remove NFS mount options from warewulf.conf
- Replace NFS support / resource prefix with "fstab" resource
- Move resources to profiles
- Migrate warewulf.conf mounts to nodes.conf with `wwctl upgrade`
- Add documentation

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-17 10:33:37 -07:00
Jonathon Anderson
eff1edd038 Fixing tests in review of #1568
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-17 01:27:15 -07:00
Christian Goll
07c77a63d5 use list of resources in profiles/nodes
access the resource not at node or profile level but
in the templates as global variable

Signed-off-by: Christian Goll <cgoll@suse.com>
2025-01-16 23:00:37 -07:00
Christian Goll
5ff27061a3 added remote resources
Signed-off-by: Christian Goll <cgoll@suse.com>
2025-01-16 23:00:37 -07:00
Christian Goll
455d9b65e4 Fix panic ObjectIsEmpty for bool
Signed-off-by: Christian Goll <cgoll@suse.com>
2025-01-15 13:34:45 +01:00
Jonathon Anderson
7e742b0d8a Fix DelProfile to operate on profiles, not nodes.
- Fixes: #1622

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-27 05:58:46 -07:00
Jonathon Anderson
749f1eba1d Fix a panic introduced by #1598
- Fixes: #1618

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 13:46:04 -07:00
Jonathon Anderson
a18913924d Benchmarking for wwctl overlay build
- Benchmarks overlay build in an environment with 1000 nodes
- Updates testenv to support both benchmarks and tests

To execute:

```
go test github.com/warewulf/warewulf/internal/app/wwctl/overlay/build -bench Benchmark_Overlay_Build
```

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 12:34:23 -07:00
Jonathon Anderson
83af6021c0 Recast Profiles as a Profile field and support recursion
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 09:10:05 -07:00
Jonathon Anderson
deaf9c99d7 Remove DEBUG logging in test suite
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 09:10:02 -07:00
Jonathon Anderson
1a3d037703 Refactor GetNode merging with new MergeNode method
- Adds many tests for node+profile merging
- Ensures that tracked fields match mergo results

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-25 09:07:28 -07:00
Jonathon Anderson
a80ba8ee01 Configure nodes.conf path dynamically from config
Removes the use of init() to initialize the variable.

- Closes: #1596
- See also: #1569

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-12-17 11:04:43 -07:00