Merge pull request #1010 from anderbubble/distro-ipxe

Use distribution iPXE
This commit is contained in:
Christian Goll
2023-12-21 08:48:36 +01:00
committed by GitHub
15 changed files with 97 additions and 63 deletions

View File

@@ -117,6 +117,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- only write IPMI if write is true
- Don't show an error if image files for containers can't be found. #933
- Make configured paths available in overlays as `.Path` #960
- Introduced IPXESOURCE environment variable which allows to specify the path to iPXE
binaries not provided by warewulf
- use distrubtion ipxe binaries in the rpm
- Allow absolute iPXE paths in warewulf.conf
- Support importing containers with symlinked `/bin/sh` #797
- Don't panic on malformed passwd #527

View File

@@ -68,7 +68,7 @@ etc/bash_completion.d/wwctl: wwctl
.PHONY: lint
lint: $(config)
$(GOLANGCI_LINT) run --build-tags "$(WW_GO_BUILD_TAGS)" --skip-dirs internal/pkg/staticfiles --timeout=5m ./...
$(GOLANGCI_LINT) run --build-tags "$(WW_GO_BUILD_TAGS)" --timeout=5m ./...
.PHONY: vet
vet: $(config)
@@ -102,7 +102,8 @@ install: build docs
install -d -m 0755 $(DESTDIR)$(WWDOCDIR)
install -d -m 0755 $(DESTDIR)$(FIREWALLDDIR)
install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR)
install -d -m 0755 $(DESTDIR)$(WWDATADIR)/ipxe
install -d -m 0755 $(DESTDIR)$(IPXESOURCE)
install -d -m 0755 $(DESTDIR)$(DATADIR)/warewulf
test -f $(DESTDIR)$(WWCONFIGDIR)/warewulf.conf || install -m 0644 etc/warewulf.conf $(DESTDIR)$(WWCONFIGDIR)
test -f $(DESTDIR)$(WWCONFIGDIR)/nodes.conf || install -m 0644 etc/nodes.conf $(DESTDIR)$(WWCONFIGDIR)
test -f $(DESTDIR)$(WWCONFIGDIR)/wwapic.conf || install -m 0644 etc/wwapic.conf $(DESTDIR)$(WWCONFIGDIR)
@@ -132,10 +133,6 @@ install: build docs
install -m 0644 etc/bash_completion.d/wwctl $(DESTDIR)$(BASHCOMPDIR)/wwctl
for f in docs/man/man1/*.1.gz; do install -m 0644 $$f $(DESTDIR)$(MANDIR)/man1/; done
for f in docs/man/man5/*.5.gz; do install -m 0644 $$f $(DESTDIR)$(MANDIR)/man5/; done
install -m 0644 staticfiles/README-ipxe.md $(DESTDIR)$(WWDATADIR)/ipxe
install -m 0644 staticfiles/arm64.efi $(DESTDIR)$(WWDATADIR)/ipxe
install -m 0644 staticfiles/x86_64.efi $(DESTDIR)$(WWDATADIR)/ipxe
install -m 0644 staticfiles/x86_64.kpxe $(DESTDIR)$(WWDATADIR)/ipxe
.PHONY: init
init:
@@ -147,7 +144,7 @@ init:
dist:
rm -rf .dist/ $(WAREWULF)-$(VERSION).tar.gz
mkdir -p .dist/$(WAREWULF)-$(VERSION)
rsync -a --exclude=".*" --exclude "*~" * .dist/$(WAREWULF)-$(VERSION)/
rsync -a --exclude=".github" --exclude=".vscode" --exclude "*~" * .dist/$(WAREWULF)-$(VERSION)/
cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
rm -rf .dist

View File

@@ -13,36 +13,69 @@
## About Warewulf
### History
For over two decades, Warewulf has powered HPC systems around the world. From simple “under the desk” clusters to large
institutional systems at HPC centers as well as enterprises who rely on performance critical computing.
Through the evolution of Warewulf, we have seen various iterations provisioning models starting from CDROM / ISO images
to Etherboot (predecessor to PXE), then PXE, and more recently iPXE, but even during these different bootloaders,
Warewulf in its heart, has always been first and foremost a stateless provisioning system (e.g. the operating system
node image is not written to any persistent storage and rather it boots from the network directly into a runtime
system).
For over two decades, Warewulf has powered HPC systems around the
world. From simple “under the desk” clusters to large institutional
systems at HPC centers as well as enterprises who rely on performance
critical computing.
Warewulf v3 has been in production for over 6 years now as it has stabilized into a very solid and full featured
solution. But over the last few years, there have been many innovations in Enterprise technologies which can (and
should) be leveraged as part of Warewulf. Additionally, some of the lessons learned from Warewulf v3 architecture
should be rolled into an updated architecture for provisioning management.
Through the evolution of Warewulf, we have seen various iterations
provisioning models starting from CDROM / ISO images to Etherboot
(predecessor to PXE), then PXE, and more recently iPXE, but even
during these different bootloaders, Warewulf in its heart, has always
been first and foremost a stateless provisioning system (e.g. the
operating system node image is not written to any persistent storage
and rather it boots from the network directly into a runtime system).
Warewulf v3 has been in production for over 6 years now as it has
stabilized into a very solid and full featured solution. But over the
last few years, there have been many innovations in Enterprise
technologies which can (and should) be leveraged as part of
Warewulf. Additionally, some of the lessons learned from Warewulf v3
architecture should be rolled into an updated architecture for
provisioning management.
### Warewulf v4
Leveraging this legacy of provisioning and cluster management brings us to where we are today. The next generation
of Warewulf. Warewulf v4 is a complete rewrite in GoLang, taking in the legacy of what we've come to expect with
Warewulf, bringing it into the present, and looking out into the future.
Warewulf v4 combines ultra scalability, flexibility, and simplicity with being light weight, non-intrusive, and a
great tool for scientists and seasoned system administrators alike. Warewulf empowers you to scalably and easily manage
thousands of compute resources.
Leveraging this legacy of provisioning and cluster management brings
us to where we are today. The next generation of Warewulf. Warewulf v4
is a complete rewrite in GoLang, taking in the legacy of what we've
come to expect with Warewulf, bringing it into the present, and
looking out into the future.
Warewulf v4 combines ultra scalability, flexibility, and simplicity
with being light weight, non-intrusive, and a great tool for
scientists and seasoned system administrators alike. Warewulf empowers
you to scalably and easily manage thousands of compute resources.
### Architecture
One of the design tenants of Warewulf is how to scalably administrate many thousands of compute nodes. Generally
speaking, operating system state introduce a surface for potential discrepancies and version creep between nodes and
thus Warewulf has always gone with the "single system image" approach to clustered operating system management.
This means that you can have a single management node "image". For the last 20 years, we've been calling this a
Virtual Node File System (VNFS), but in hindsight, this is a container.
At its core, Warewulf v4 focuses on what has made Warewulf so widely loved: simplicity, ultra scalable, lightweight,
and an easy to manage solution built for both scientists and seasons system administrators to be able to design a
highly functional yet easy to maintain cluster no matter how big or small or customized it needs to be.
One of the design tenants of Warewulf is how to scalably administrate
many thousands of compute nodes. Generally speaking, operating system
state introduce a surface for potential discrepancies and version
creep between nodes and thus Warewulf has always gone with the "single
system image" approach to clustered operating system management. This
means that you can have a single management node "image". For the last
20 years, we've been calling this a Virtual Node File System (VNFS),
but in hindsight, this is a container.
At its core, Warewulf v4 focuses on what has made Warewulf so widely
loved: simplicity, ultra scalable, lightweight, and an easy to manage
solution built for both scientists and seasons system administrators
to be able to design a highly functional yet easy to maintain cluster
no matter how big or small or customized it needs to be.
## iPXE
Warewulf uses iPXE for network boot. Typically iPXE is provided by the
operating system; but the iPXE binaries can be rebuilt with the
`ipxe-update.sh` script. This script accepts command-line arguments
that are passed to the underlying `make` process. e.g.,
```bash
echo "#!ipxe
echo Tagging with vlan 1000
vcreate --tag 1000 net0 autoboot || shell" >vlan-1000.ipxe
sh ipxe-update.sh EMBED=$(readlink -f vlan-1000.ipxe)
```

View File

@@ -37,7 +37,7 @@ ifdef PREFIX
endif
# System directory paths
VARLIST += PREFIX BINDIR SYSCONFDIR SRVDIR DATADIR MANDIR DOCDIR LOCALSTATEDIR
VARLIST += PREFIX BINDIR SYSCONFDIR SRVDIR DATADIR MANDIR DOCDIR LOCALSTATEDIR RELEASE
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SYSCONFDIR ?= $(PREFIX)/etc
@@ -68,7 +68,7 @@ endif
TFTPDIR ?= /var/lib/tftpboot
# Warewulf directory paths
VARLIST += WWCLIENTDIR WWCONFIGDIR WWPROVISIONDIR WWOVERLAYDIR WWCHROOTDIR WWTFTPDIR WWDOCDIR WWDATADIR
VARLIST += WWCLIENTDIR WWCONFIGDIR WWPROVISIONDIR WWOVERLAYDIR WWCHROOTDIR WWTFTPDIR WWDOCDIR WWDATADIR IPXESOURCE
WWCONFIGDIR := $(SYSCONFDIR)/$(WAREWULF)
WWPROVISIONDIR := $(LOCALSTATEDIR)/$(WAREWULF)/provision
WWOVERLAYDIR := $(LOCALSTATEDIR)/$(WAREWULF)/overlays
@@ -80,6 +80,8 @@ WWCLIENTDIR ?= /warewulf
CONFIG := $(shell pwd)
IPXESOURCE ?= $(PREFIX)/share/ipxe
# helper functions
godeps=$(shell go list -mod vendor -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g")

View File

@@ -17,6 +17,11 @@ dhcp:
tftp:
enabled: true
systemd name: tftp
ipxe:
00:09: ipxe-snponly-x86_64.efi
00:00: undionly.kpxe
00:0B: arm64-efi/snponly.efi
00:07: ipxe-snponly-x86_64.efi
nfs:
enabled: true
export paths:

View File

@@ -7,6 +7,7 @@ type BuildConfig struct {
Sysconfdir string `default:"@SYSCONFDIR@"`
Datadir string `default:"@DATADIR@"`
Localstatedir string `default:"@LOCALSTATEDIR@"`
Ipxesource string `default:"@IPXESOURCE@"`
Srvdir string `default:"@SRVDIR@"`
Tftpdir string `default:"@TFTPDIR@"`
Firewallddir string `default:"@FIREWALLDDIR@"`

View File

@@ -7,6 +7,5 @@ type TFTPConf struct {
TftpRoot string `yaml:"tftproot" default:"/var/lib/tftpboot"`
SystemdName string `yaml:"systemd name" default:"tftp"`
// Path is relative to buildconfig.DATADIR()
IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"ipxe/ipxe-snponly-x86_64.efi\",\"00:00\": \"ipxe/undionly.kpxe\",\"00:0B\": \"ipxe/arm64-efi/snponly.efi\",\"00:07\": \"ipxe/ipxe-snponly-x86_64.efi\"}"`
}

View File

@@ -23,11 +23,14 @@ func TFTP() error {
fmt.Printf("Writing PXE files to: %s\n", tftpdir)
copyCheck := make(map[string]bool)
for _, f := range controller.TFTP.IpxeBinaries {
if !path.IsAbs(f) {
f = path.Join(controller.Paths.Ipxesource, f)
}
if copyCheck[f] {
continue
}
copyCheck[f] = true
err = util.SafeCopyFile(path.Join(controller.Paths.Datadir, f), path.Join(tftpdir, path.Base(f)))
err = util.SafeCopyFile(f, path.Join(tftpdir, path.Base(f)))
if err != nil {
wwlog.Warn("ipxe binary could not be copied, booting may not work: %s", err)
}

View File

@@ -8,8 +8,8 @@ ARCH=x86_64
PCBIOS=bin-${ARCH}-pcbios/undionly.kpxe
EFI=bin-${ARCH}-efi/ipxe.efi
PCBIOS_output=`pwd`/staticfiles/${ARCH}.kpxe
EFI_output=`pwd`/staticfiles/${ARCH}.efi
PCBIOS_output=${ARCH}.kpxe
EFI_output=${ARCH}.efi
SYSBIOS="/usr/share/ipxe/undionly.kpxe"
SYSEFI="/usr/share/ipxe/ipxe-${ARCH}.efi"

View File

@@ -1,19 +0,0 @@
# Warewulf-provided iPXE binaries
- `arm64.efi` - EFI support for `arm64` processors
- `x86_64.efi` - EFI support for `x86_64` processors
- `x86_64.kpxe` - legacy BIOS support for `x86_64` processors
## Rebuilding
The iPXE binaries can be rebuilt with the `ipxe-update.sh`
script. This script accepts command-line arguments that are passed to
the underlying `make` process. e.g.,
```bash
echo "#!ipxe
echo Tagging with vlan 1000
vcreate --tag 1000 net0 autoboot || shell" >vlan-1000.ipxe
sh ipxe-update.sh EMBED=$(readlink -f vlan-1000.ipxe)
```

View File

@@ -1,5 +0,0 @@
# Warewulf-bundled static files
These files are bundled statically with Warewulf 4.
See also: [README-ipxe.md](README-ipxe.md)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -39,9 +39,11 @@ BuildRequires: go >= 1.16
BuildRequires: firewall-macros
BuildRequires: firewalld
BuildRequires: tftp
BuildRequires: yq
Requires: tftp
Requires: nfs-kernel-server
Requires: firewalld
Requires: ipxe-bootimgs
%else
# Assume Red Hat/Fedora build
BuildRequires: system-release
@@ -50,6 +52,8 @@ BuildRequires: golang >= 1.16
BuildRequires: firewalld-filesystem
Requires: tftp-server
Requires: nfs-utils
Requires: ipxe-bootimgs-x86
Requires: ipxe-bootimgs-aarch64
%endif
%if 0%{?rhel} >= 8 || 0%{?suse_version} || 0%{?fedora}
@@ -89,7 +93,8 @@ make defaults \
SYSTEMDDIR=%{_unitdir} \
BASHCOMPDIR=/etc/bash_completion.d/ \
FIREWALLDDIR=/usr/lib/firewalld/services \
WWCLIENTDIR=/warewulf
WWCLIENTDIR=/warewulf \
IPXESOURCE=/usr/share/ipxe
make
@@ -102,6 +107,15 @@ make install \
%pre
getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
# use ipxe images from the distribution
%if 0%{?suse_version} || 0%{?sle_version}
yq e '
.tftp.ipxe."00:00" = "undionly.kpxe" |
.tftp.ipxe."00:07" = "ipxe-x86_64.efi" |
.tftp.ipxe."00:09" = "ipxe-x86_64.efi" |
.tftp.ipxe."00:0B" = "snp-arm64.efi" ' \
-i %{buildroot}%{_sysconfdir}/warewulf/warewulf.conf
%endif
%post