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 - only write IPMI if write is true
- Don't show an error if image files for containers can't be found. #933 - Don't show an error if image files for containers can't be found. #933
- Make configured paths available in overlays as `.Path` #960 - 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 - Support importing containers with symlinked `/bin/sh` #797
- Don't panic on malformed passwd #527 - Don't panic on malformed passwd #527

View File

@@ -68,7 +68,7 @@ etc/bash_completion.d/wwctl: wwctl
.PHONY: lint .PHONY: lint
lint: $(config) 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 .PHONY: vet
vet: $(config) vet: $(config)
@@ -102,7 +102,8 @@ install: build docs
install -d -m 0755 $(DESTDIR)$(WWDOCDIR) install -d -m 0755 $(DESTDIR)$(WWDOCDIR)
install -d -m 0755 $(DESTDIR)$(FIREWALLDDIR) install -d -m 0755 $(DESTDIR)$(FIREWALLDDIR)
install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR) 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)/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)/nodes.conf || install -m 0644 etc/nodes.conf $(DESTDIR)$(WWCONFIGDIR)
test -f $(DESTDIR)$(WWCONFIGDIR)/wwapic.conf || install -m 0644 etc/wwapic.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 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/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 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 .PHONY: init
init: init:
@@ -147,7 +144,7 @@ init:
dist: dist:
rm -rf .dist/ $(WAREWULF)-$(VERSION).tar.gz rm -rf .dist/ $(WAREWULF)-$(VERSION).tar.gz
mkdir -p .dist/$(WAREWULF)-$(VERSION) 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) cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
rm -rf .dist rm -rf .dist

View File

@@ -13,36 +13,69 @@
## About Warewulf ## About Warewulf
### History ### 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 For over two decades, Warewulf has powered HPC systems around the
to Etherboot (predecessor to PXE), then PXE, and more recently iPXE, but even during these different bootloaders, world. From simple “under the desk” clusters to large institutional
Warewulf in its heart, has always been first and foremost a stateless provisioning system (e.g. the operating system systems at HPC centers as well as enterprises who rely on performance
node image is not written to any persistent storage and rather it boots from the network directly into a runtime critical computing.
system).
Warewulf v3 has been in production for over 6 years now as it has stabilized into a very solid and full featured Through the evolution of Warewulf, we have seen various iterations
solution. But over the last few years, there have been many innovations in Enterprise technologies which can (and provisioning models starting from CDROM / ISO images to Etherboot
should) be leveraged as part of Warewulf. Additionally, some of the lessons learned from Warewulf v3 architecture (predecessor to PXE), then PXE, and more recently iPXE, but even
should be rolled into an updated architecture for provisioning management. 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 ### 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 Leveraging this legacy of provisioning and cluster management brings
great tool for scientists and seasoned system administrators alike. Warewulf empowers you to scalably and easily manage us to where we are today. The next generation of Warewulf. Warewulf v4
thousands of compute resources. 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 ### 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, One of the design tenants of Warewulf is how to scalably administrate
and an easy to manage solution built for both scientists and seasons system administrators to be able to design a many thousands of compute nodes. Generally speaking, operating system
highly functional yet easy to maintain cluster no matter how big or small or customized it needs to be. 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 endif
# System directory paths # 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 PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin BINDIR ?= $(PREFIX)/bin
SYSCONFDIR ?= $(PREFIX)/etc SYSCONFDIR ?= $(PREFIX)/etc
@@ -68,7 +68,7 @@ endif
TFTPDIR ?= /var/lib/tftpboot TFTPDIR ?= /var/lib/tftpboot
# Warewulf directory paths # 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) WWCONFIGDIR := $(SYSCONFDIR)/$(WAREWULF)
WWPROVISIONDIR := $(LOCALSTATEDIR)/$(WAREWULF)/provision WWPROVISIONDIR := $(LOCALSTATEDIR)/$(WAREWULF)/provision
WWOVERLAYDIR := $(LOCALSTATEDIR)/$(WAREWULF)/overlays WWOVERLAYDIR := $(LOCALSTATEDIR)/$(WAREWULF)/overlays
@@ -80,6 +80,8 @@ WWCLIENTDIR ?= /warewulf
CONFIG := $(shell pwd) CONFIG := $(shell pwd)
IPXESOURCE ?= $(PREFIX)/share/ipxe
# helper functions # 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") 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: tftp:
enabled: true enabled: true
systemd name: tftp 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: nfs:
enabled: true enabled: true
export paths: export paths:

View File

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

View File

@@ -7,6 +7,5 @@ type TFTPConf struct {
TftpRoot string `yaml:"tftproot" default:"/var/lib/tftpboot"` TftpRoot string `yaml:"tftproot" default:"/var/lib/tftpboot"`
SystemdName string `yaml:"systemd name" default:"tftp"` 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\"}"` 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) fmt.Printf("Writing PXE files to: %s\n", tftpdir)
copyCheck := make(map[string]bool) copyCheck := make(map[string]bool)
for _, f := range controller.TFTP.IpxeBinaries { for _, f := range controller.TFTP.IpxeBinaries {
if !path.IsAbs(f) {
f = path.Join(controller.Paths.Ipxesource, f)
}
if copyCheck[f] { if copyCheck[f] {
continue continue
} }
copyCheck[f] = true 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 { if err != nil {
wwlog.Warn("ipxe binary could not be copied, booting may not work: %s", err) 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 PCBIOS=bin-${ARCH}-pcbios/undionly.kpxe
EFI=bin-${ARCH}-efi/ipxe.efi EFI=bin-${ARCH}-efi/ipxe.efi
PCBIOS_output=`pwd`/staticfiles/${ARCH}.kpxe PCBIOS_output=${ARCH}.kpxe
EFI_output=`pwd`/staticfiles/${ARCH}.efi EFI_output=${ARCH}.efi
SYSBIOS="/usr/share/ipxe/undionly.kpxe" SYSBIOS="/usr/share/ipxe/undionly.kpxe"
SYSEFI="/usr/share/ipxe/ipxe-${ARCH}.efi" 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: firewall-macros
BuildRequires: firewalld BuildRequires: firewalld
BuildRequires: tftp BuildRequires: tftp
BuildRequires: yq
Requires: tftp Requires: tftp
Requires: nfs-kernel-server Requires: nfs-kernel-server
Requires: firewalld Requires: firewalld
Requires: ipxe-bootimgs
%else %else
# Assume Red Hat/Fedora build # Assume Red Hat/Fedora build
BuildRequires: system-release BuildRequires: system-release
@@ -50,6 +52,8 @@ BuildRequires: golang >= 1.16
BuildRequires: firewalld-filesystem BuildRequires: firewalld-filesystem
Requires: tftp-server Requires: tftp-server
Requires: nfs-utils Requires: nfs-utils
Requires: ipxe-bootimgs-x86
Requires: ipxe-bootimgs-aarch64
%endif %endif
%if 0%{?rhel} >= 8 || 0%{?suse_version} || 0%{?fedora} %if 0%{?rhel} >= 8 || 0%{?suse_version} || 0%{?fedora}
@@ -89,7 +93,8 @@ make defaults \
SYSTEMDDIR=%{_unitdir} \ SYSTEMDDIR=%{_unitdir} \
BASHCOMPDIR=/etc/bash_completion.d/ \ BASHCOMPDIR=/etc/bash_completion.d/ \
FIREWALLDDIR=/usr/lib/firewalld/services \ FIREWALLDDIR=/usr/lib/firewalld/services \
WWCLIENTDIR=/warewulf WWCLIENTDIR=/warewulf \
IPXESOURCE=/usr/share/ipxe
make make
@@ -102,6 +107,15 @@ make install \
%pre %pre
getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup} 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 %post