ipxe

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BootTemplate = template.Must(template.New("iPXE embedded").Parse(`#!ipxe
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

{{/* print interfaces */}}
ifstat

{{/* retry 10 times overall */}}
set attempts:int32 10
set x:int32 0

:retry_loop

	set idx:int32 0

	:loop
		{{/* try DHCP on each interface */}}
		isset ${net${idx}/mac} || goto exhausted

		ifclose
		iflinkwait --timeout 5000 net${idx} || goto next_iface
		dhcp net${idx} || goto next_iface
		goto boot

	:next_iface
		inc idx && goto loop

	:boot
		{{/* attempt boot, if fails try next iface */}}
		route

		chain --replace http://{{ .Endpoint }}:{{ .Port }}/ipxe?uuid=${uuid}&mac=${net${idx}/mac:hexhyp}&domain=${domain}&hostname=${hostname}&serial=${serial}&arch=${buildarch} || goto next_iface

:exhausted
	echo
	echo Failed to iPXE boot successfully via all interfaces

	iseq ${x} ${attempts} && goto fail ||

	echo Retrying...
	echo

	inc x
	goto retry_loop

:fail
	echo
	echo Failed to get a valid response after ${attempts} attempts
	echo

	echo Rebooting in 5 seconds...
	sleep 5
	reboot
`))

BootTemplate is embedded into iPXE binary when that binary is sent to the node.

View Source
var ErrBootFromDisk = errors.New("boot from disk")

Functions

func Check

func Check(addr string) healthz.Checker

func PatchBinaries

func PatchBinaries(script []byte) error

PatchBinaries patches iPXE binaries on the fly with the new embedded script.

This relies on special build in `pkgs/ipxe` where a placeholder iPXE script is embedded. EFI iPXE binaries are uncompressed, so these are patched directly. BIOS amd64 undionly.pxe is compressed, so we instead patch uncompressed version and compress it back using zbin. (zbin is built with iPXE).

func RegisterIPXE

func RegisterIPXE(mux *http.ServeMux, endpoint string, port int, args string, bootMethod siderotypes.BootFromDisk, iPXEPort int, mgrClient client.Client) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL