Commit Graph

109 Commits

Author SHA1 Message Date
Jonathon Anderson
fbd5ca9895 Recommended refactors
- make sure spec sets new cache dir
- move clean out of api
- capture warewulfconf.Paths.Cachedir+"/warewulf" in once place
- split Clean() into multiple functions
- remove WriteFileAbs

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-28 15:20:41 -06:00
Jonathon Anderson
b331fd12af Remove dead code
Verified with

```
deadcode -test ./...
```

Followed-up with a lint check.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-18 15:09:01 -06:00
Jonathon Anderson
f7f8dfcf5c Fix a regression in passing metadata to grub.cfg.ww
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-17 15:39:59 -04:00
Christian Goll
342236b9b9 updated test for yaml/v3
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:54 -04:00
Christian Goll
5bd4fd4712 use yaml/v3 and don't export Nodes
introduced wwbool and don't export
Nodes and NodeConfs. This requires new
explict Yaml (un)marshaling as the standard
marshaller won't touch these fields

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:54 -04:00
Christian Goll
ac6cd69ca6 fix test to run without NodeInfo
Also removed --fullall from node list and profile list

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 15:30:47 -04:00
Christian Goll
28a7b9fe84 removed NodeInfo and using NodeConf instead
This is a significant change in the undelying data model!

nodeDb, err := node.New()

will result in a structure which contains the on disk
values. Only

nodeDb.FindAllNodes() or nodeDb.GetNode(id) will give
the nodes with its merged in profiles.

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-10-17 13:35:42 -04:00
Jonathon Anderson
9050622f68 Ensure autobuilt overlays include contextual overlay contents.
Following #1249, autobuilt overlays were being built with no contents.

This change follows the pattern in `wwctl overlay build` to include configured
overlays when none are explicitly specified.

Inspired by #1296.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-07-10 16:06:06 -04:00
Jonathon Anderson
05b951d78d Support dracut booting with GRUB
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-06-06 16:34:53 -04:00
xu yang
48d6b63030 Add tests for new iPXE template variables
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-06-06 03:20:12 -04:00
Jonathon Anderson
53dae60e20 New, optional dracut.ipxe configuration
dracut.ipxe boots an initramfs detected in the container image. This
required a few small changes to warewulfd and the wwinit overlay to
accommodate the dracut initramfs configuring the network interface
before wwinit:

- Include .NetDevs in the ipxe configuration template, so that dracut
  can configure interfaces with the correct names.

- Configure NetworkManager to not keep the initramfs configuration, in
  stead applying the configuration found by wwinit.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-06-06 03:20:09 -04:00
xu yang
a322061fe9 Add initramfs stage to warewulfd
The initramfs stage supports serving an initramfs image from within the
container image, typically generated by dracut.

Signed-off-by: xu yang <xyang@ciq.com>
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-06-06 03:14:21 -04:00
David McFarlane
41535cb8f9 Also prevent provisioning arbitrary overlays in secure mode
Signed-off-by: David McFarlane <54093156+Prepultrue@users.noreply.github.com>
2024-05-08 11:37:20 +10:00
Christian Goll
2ba9efa57c created kernel.FindKernel reduces code complexity
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-04-19 16:12:22 -06:00
Christian Goll
71f5d42942 Add a read write mutex for node status
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-04-17 12:55:02 -06:00
John Hanks
cbf9178f10 Provide sprig functions in overlay templates 2024-03-11 09:36:52 +01:00
Christian Goll
1fca0057d3 updated WW_INTERNAL to 45 for 4.5.x release
Internal version update is necessary as new structures were added,
most obviously the disk, partitions and file system structures.
Old configurations will work as expected.

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-02-16 20:12:51 -07:00
Christian Goll
5e94766895 do not export version and rc
create also a new warewulf.conf so that the compiled
in paths are in sync with the configuration

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-02-16 17:38:34 -07:00
Jonathon Anderson
a1832ad8c1 Complete transfer of Warewulf from HPCng
Warewulf is now being maintained in its own GitHub organization at
github.com/warewulf

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-01-26 21:35:04 -07:00
Christian Goll
725176cfed cleanup code after review
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
4379c4c18d use grub/shim from host system
Also the boot method is now configured globaly as this is
the only way to make sure that unkonwn nodes get the right
stuff

Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
724441dc79 added test for shim and efi send
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
0c9bf78cd0 using ProvisionSend instean of GrubSend
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
60dc8f6251 enable grub boot for all nodes
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
03ef7447e9 copy shim/grub on default profile container change
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
2fe98e5f55 default profile needs to have a container
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Christian Goll
a36cb23319 added shim/grub find to provision process
Signed-off-by: Christian Goll <cgoll@suse.com>
2024-01-17 18:02:04 -07:00
Jonathon Anderson
2b49bcad27 Expand test descriptions and simplify some tests
As part of reviewing this PR, I expanded the test definitions to make it
easier to discern the intent of each test at a glance. In so doing I
understood most tests behaving as normal, but I did make a few small
changes:

- Some tests no longer produce any errors, so remove this variable from
  the test definitions.
- Replace comma-separated overlay definitions with explicit slices.
  Splitting comma-separated strings led to erroneous behavior where a
  null overlay list was processed as a single null overlay rather than
  an empty slice.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-10-25 22:35:49 -06:00
Christian Goll
767be4fd8c refactored util_test.go to test on real files
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-25 22:35:49 -06:00
Christian Goll
242276bba9 fixed tests and added explcit error handling
Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-25 22:35:49 -06:00
Christian Goll
e90616cafb calling the overlay build functions direclty
The warewulfd process called `wwctl build -O [system|runtime] node`
if autobuild was set. This created [system|runtime].img which isn't
supported with the build model. Calling now BuildOverlay directly

Signed-off-by: Christian Goll <cgoll@suse.com>
2023-10-25 22:35:45 -06:00
Jonathon Anderson
42842aeee1 Format entire source code using make fmt
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-10-23 17:56:20 -06:00
Jonathon Anderson
9cf47da963 Fix warewulfd for new contextual overlay names
The recent PR #883 replaced the standard overlay naming convention with
static names for each of the runtime and wwinit/system contexts; but the
method by which it left the "legacy" naming convention in place led to a
bug where warewulfd was still attempting to serve overlays with the
previous naming convention, though this name wasn't being built.

This PR refactors contextual overlay image naming to be, I think, a more
typical golang pattern, and updates affected code to match.

This PR also included tests for all functions modified by this change.

Fixes #896

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2023-09-02 11:18:38 -06:00
griznog
13c426de1c Add an argument to the runtime/system overlay related functions to carry the context to getOverlayFile() for building the img name. 2023-07-27 07:27:20 -05:00
jason yang
911cb4a3b9 squash commits
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
2023-05-15 10:34:36 +00:00
Jonathon Anderson
70292276e2 Rename BaseConf.New to BaseConf.Get
Since BaseConf.New could return a cached BaseConf, rather than always
constructing a new struct, I've renamed it to Get to more accurately
reflect its use. A new New() method is called by Get and always
initializes a new struct.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00
Jonathon Anderson
c461e65a98 Rename pkg/warewulfconf to pkg/config
Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00
Christian Goll
3367b67b9f added a test for wwctl node add
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-07 09:05:29 +01:00
Christian Goll
ce43dfa0b7 removed getters as configs must exportable
Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-06 10:20:00 +01:00
Christian Goll
377702a179 make the configuration to be based in warewulf.conf
defaults will be se by the Makefile

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-03 16:02:41 +01:00
Christian Goll
78978ad233 added warewulfconf as command line parameter
the environment variable WAREWULFCONF is also recognized

Signed-off-by: Christian Goll <cgoll@suse.de>
2023-03-03 11:18:49 +01:00
mslacken
ab0ee87629 updated linter and fixed deprecated stuff 2022-10-14 17:40:16 +02:00
Gregory M. Kurtzer
4d44d3a299 Merge pull request #438 from kcdodd/fix/srvdisco
Fix server thread safety of discoverable node and overlay build
2022-06-09 22:18:23 -07:00
Jean-Baptiste Denis
78144ba760 Correct typo in log messages 2022-06-07 16:51:03 +02:00
Carter Dodd
3242d2998e fixups 2022-06-05 17:37:23 -05:00
Carter Dodd
30ba916703 Move overlay build logic to util, add limit to spawned processes 2022-06-05 17:28:14 -05:00
Carter Dodd
f14f339576 fixups 2022-06-04 11:42:16 -05:00
Carter Dodd
fc8d3863d8 use wwctl to re-build provision overlays, update to pass overlaynames 2022-06-04 11:14:48 -05:00
Carter Dodd
7caabc439d separate safe/unsafe db operations 2022-06-02 22:22:19 -05:00
Carter Dodd
04fb854aa7 fixup import 2022-06-02 20:20:03 -05:00