Documentation
¶
Index ¶
- Constants
- func MetricsRegistry() *prometheus.Registry
- type BackendReader
- type Bind
- type Bootstrap
- type Config
- func (c *Config) BinaryHandler(log logr.Logger) http.Handler
- func (c *Config) BootstrapHandler(log logr.Logger) http.Handler
- func (c *Config) ISOHandler(log logr.Logger) (http.Handler, error)
- func (c *Config) ISOHandlerV6(log logr.Logger) (http.Handler, error)
- func (c *Config) InitMetrics()
- func (c *Config) PXEHTTPHandler(log logr.Logger) http.Handler
- func (c *Config) ScriptHandler(log logr.Logger) http.Handler
- func (c *Config) Start(ctx context.Context, log logr.Logger) error
- func (c *Config) Transformer(typ reflect.Type) func(dst, src reflect.Value) error
- type DHCP
- type DHCPMode
- type DHCPv6
- type DHCPv6Mode
- type IPXE
- type IPXEHTTPBinary
- type IPXEHTTPBinaryServer
- type IPXEHTTPScript
- type IPXEHTTPScriptServer
- type ISO
- type OTEL
- type PXEHTTP
- type Syslog
- type TFTP
- type TLS
- type TinkServer
Constants ¶
const ( DHCPModeProxy DHCPMode = "proxy" DHCPModeReservation DHCPMode = "reservation" DHCPModeAutoProxy DHCPMode = "auto-proxy" DHCPv6ModeStateless DHCPv6Mode = "stateless" DHCPv6ModeAutoStateless DHCPv6Mode = "auto-stateless" DHCPv6ModeReservation DHCPv6Mode = "reservation" DHCPv6ModeDerived DHCPv6Mode = "derived" // Defaults consumers can use. DefaultTFTPAssetDir = "" DefaultPXEHTTPPathPrefix = "/tftp/" DefaultTFFTPPort = 69 DefaultTFFTPBlockSize = 512 DefaultTFFTPSinglePort = true DefaultTFFTPTimeout = 10 * time.Second DefaultDHCPPort = 67 DefaultSyslogPort = 514 DefaultTinkServerPort = 42113 IPXEBinaryURI = "/ipxe/binary/" IPXEScriptURI = "/ipxe/script/" ISOURI = "/iso/" ISOURIV6 = "/iso6/" BootstrapURI = "/bootstrap/" // DHCPv6ServerDUIDHashPrefix scopes derived server DUIDs to Smee DHCPv6. DHCPv6ServerDUIDHashPrefix = "tinkerbell:smee:dhcpv6:" )
Variables ¶
This section is empty.
Functions ¶
func MetricsRegistry ¶ added in v0.23.0
func MetricsRegistry() *prometheus.Registry
MetricsRegistry returns the Prometheus registry that contains all Smee metrics. It can be used to serve Smee metrics on a dedicated endpoint (e.g. /smee/metrics).
Types ¶
type BackendReader ¶
type BackendReader interface {
FilterHardware(ctx context.Context, opts data.HardwareFilter) (*tinkerbell.Hardware, error)
}
BackendReader is the interface for getting data from a backend.
type Bind ¶ added in v0.26.0
Bind is the per-family listen address shared with every other Tinkerbell listener. The alias keeps existing field access compiling, but a caller that builds a Bind must now set Enabled: an address alone no longer serves a family, and Start reports the family as unserved without it.
type Bootstrap ¶ added in v0.26.0
type Bootstrap struct {
// Enabled is a flag to enable or disable serving bootstrap archives.
Enabled bool
}
Bootstrap configures delivery of per-host configuration to the OS before its networking starts. The same archive reaches the machine two ways: written into the bootstrap slot of ISOs that reserve one, or fetched over HTTP as an extra initrd for iPXE. Enabled turns on both.
type Config ¶
type Config struct {
// Backend is the backend to use for getting data.
Backend BackendReader
// Bootstrap is the configuration for serving per-host bootstrap data.
Bootstrap Bootstrap
// DHCP is the configuration for the DHCP service.
DHCP DHCP
// DHCPv6 is the configuration for the DHCPv6 service.
DHCPv6 DHCPv6
// IPXE is the configuration for the iPXE service.
IPXE IPXE
// ISO is the configuration for the ISO service.
ISO ISO
// OTEL is the configuration for OpenTelemetry.
OTEL OTEL
// PXEHTTP is the configuration for serving pxelinux.cfg and the TFTP asset
// dir over the HTTP server (for u-boot pxe-over-http).
PXEHTTP PXEHTTP
// Syslog is the configuration for the syslog service.
Syslog Syslog
// TFTP is the configuration for the TFTP service.
TFTP TFTP
// TinkServer is the configuration for the Tinkerbell server.
TinkServer TinkServer
// TLS is the configuration for TLS.
TLS TLS
}
Config is the configuration for the Smee service.
func NewConfig ¶
NewConfig is a constructor for the Config struct. It will set default values for the Config struct. Syslog and TFTP bind addresses remain unset unless provided in c. Boolean fields are not set-able via c. To set boolean, modify the returned Config struct.
func (*Config) BinaryHandler ¶ added in v0.23.0
BinaryHandler returns an http.Handler that serves iPXE binaries. Returns nil if the iPXE HTTP binary server is disabled.
func (*Config) BootstrapHandler ¶ added in v0.26.0
BootstrapHandler returns an http.Handler that serves per-host configuration archives. Returns nil if bootstrap delivery is disabled.
func (*Config) ISOHandler ¶ added in v0.23.0
ISOHandler returns an http.Handler that serves ISO images patched with IPv4 endpoints. Returns nil, nil if the ISO server is disabled.
func (*Config) ISOHandlerV6 ¶ added in v0.26.0
ISOHandlerV6 returns an http.Handler that serves ISO images patched with IPv6 endpoints. Static IPAM is never applied: the ipam kernel parameter it builds carries an IPv4 address, netmask, and gateway. Returns nil, nil if the ISO server is disabled.
func (*Config) InitMetrics ¶ added in v0.23.0
func (c *Config) InitMetrics()
InitMetrics initializes only Smee's Prometheus metrics (DHCP counters, discover/job histograms, etc.) without initializing OpenTelemetry. Use this when OTel has already been initialized at a higher level (e.g. by the consolidated tinkerbell binary) to avoid overwriting the global tracer provider.
func (*Config) PXEHTTPHandler ¶ added in v0.25.0
PXEHTTPHandler returns an http.Handler that serves pxelinux.cfg and the TFTP asset directory (c.TFTP.AssetDir) over HTTP, for clients that netboot via HTTP (eg. u-boot's pxe-over-http) using the same request path shapes as TFTP. Returns nil if PXE-over-HTTP serving is disabled.
It reuses the same Route implementations as the TFTP server, minus the embedded iPXE route (iPXE binaries are already served at IPXEBinaryURI) and the RPi route (out of scope for u-boot).
func (*Config) ScriptHandler ¶ added in v0.23.0
ScriptHandler returns an http.Handler that serves iPXE scripts. Returns nil if the iPXE HTTP script server is disabled.
type DHCP ¶
type DHCP struct {
// Enabled configures whether the DHCP server is enabled.
Enabled bool
// EnableNetbootOptions configures whether sending netboot options is enabled.
EnableNetbootOptions bool
// DefaultNameServers are used when Hardware does not provide IPv4 nameservers.
DefaultNameServers []netip.Addr
// DefaultDomainSearchList is used when Hardware does not provide a domain search list.
DefaultDomainSearchList []string
// Mode determines the behavior of the DHCP server.
// See the DHCPMode type for valid values.
Mode DHCPMode
// BindAddr is the local address to which to bind the DHCP server and listen for DHCP packets.
BindAddr netip.Addr
BindPort uint16
// BindInterface is the local interface to which to bind the DHCP server and listen for DHCP packets.
BindInterface string
// IPForPacket is the IP address to use in the DHCP packet for DHCP option 54.
IPForPacket netip.Addr
// SyslogIP is the IP address to use in the DHCP packet for DHCP option 7.
SyslogIP netip.Addr
// TFTPIP is the IP address to use in the DHCP packet for DHCP option 66.
TFTPIP netip.Addr
// TFTPPort is the port to use in the DHCP packet for DHCP option 66.
TFTPPort uint16
// IPXEHTTPBinaryURL is the URL to the iPXE binary server serving via HTTP.
IPXEHTTPBinaryURL *url.URL
// IPXEHTTPScript is the URL to the iPXE script to use.
IPXEHTTPScript IPXEHTTPScript
}
type DHCPv6 ¶ added in v0.26.0
type DHCPv6 struct {
// Enabled configures whether the DHCPv6 server is enabled.
Enabled bool
// EnableNetbootOptions configures whether sending netboot options is enabled.
EnableNetbootOptions bool
// DefaultNameServers are used when Hardware does not provide IPv6 nameservers.
DefaultNameServers []netip.Addr
// DefaultDomainSearchList is used when Hardware does not provide a domain search list.
DefaultDomainSearchList []string
// Mode determines the behavior of the DHCPv6 server.
Mode DHCPv6Mode
// ServerDUID is the DHCPv6 server identifier encoded as raw DUID bytes in hex.
// When empty, a DUID is automatically derived from AddrPortV6 or a built-in fallback.
ServerDUID string
// DerivedDirectAddressPool is an IPv6 prefix used to derive addresses for direct DHCPv6 requests.
DerivedDirectAddressPool netip.Prefix
// DerivedRelayAddressPrefix is the number of relay link-address prefix bits to use when deriving relay addresses.
DerivedRelayAddressPrefix int
// BindAddr is the local address to which to bind the DHCPv6 server and listen for DHCPv6 packets.
BindAddr netip.Addr
// BindPort is the local port to which to bind the DHCPv6 server.
BindPort uint16
// BindInterface is the local interface to which to bind the DHCPv6 server and listen for DHCPv6 packets.
BindInterface string
// SyslogIP is the IP address to use for the iPXE syslog setting served to DHCPv6 clients.
SyslogIP netip.Addr
// TFTPIP is the IP address to use in DHCPv6 boot file URLs.
TFTPIP netip.Addr
// TFTPPort is the port to use in DHCPv6 boot file URLs.
TFTPPort uint16
// IPXEHTTPBinaryURL is the URL to the iPXE binary server serving via HTTP.
IPXEHTTPBinaryURL *url.URL
// IPXEHTTPScript is the URL to the iPXE script to use.
IPXEHTTPScript IPXEHTTPScript
}
DHCPv6 is the configuration for the DHCPv6 service.
type DHCPv6Mode ¶ added in v0.26.0
type DHCPv6Mode string
func (*DHCPv6Mode) Set ¶ added in v0.26.0
func (d *DHCPv6Mode) Set(s string) error
func (DHCPv6Mode) String ¶ added in v0.26.0
func (d DHCPv6Mode) String() string
func (*DHCPv6Mode) Type ¶ added in v0.26.0
func (d *DHCPv6Mode) Type() string
type IPXE ¶
type IPXE struct {
EmbeddedScriptPatch string
HTTPBinaryServer IPXEHTTPBinaryServer
HTTPScriptServer IPXEHTTPScriptServer
// IPXEBinary are the options to use when serving iPXE binaries via TFTP or HTTP.
IPXEBinary IPXEHTTPBinary
}
type IPXEHTTPBinary ¶ added in v0.20.0
type IPXEHTTPBinary struct {
// InjectMacAddrFormat is the format to use when injecting the mac address into the iPXE binary URL.
// Valid values are "colon", "dot", "dash", "no-delimiter", and "empty".
// For example, colon: http://1.2.3.4/ipxe/ipxe.efi -> http://1.2.3.4/ipxe/40:15:ff:89:cc:0e/ipxe.efi
InjectMacAddrFormat constant.MACFormat
// IPXEArchMapping will override the default architecture to binary mapping.
IPXEArchMapping map[iana.Arch]constant.IPXEBinary
}
type IPXEHTTPBinaryServer ¶
type IPXEHTTPBinaryServer struct {
Enabled bool
}
type IPXEHTTPScript ¶
type IPXEHTTPScript struct {
URL *url.URL
// InjectMacAddress will prepend the hardware mac address to the ipxe script URL file name.
// For example: http://1.2.3.4/my/loc/auto.ipxe -> http://1.2.3.4/my/loc/40:15:ff:89:cc:0e/auto.ipxe
// Setting this to false is useful when you are not using the auto.ipxe script in Smee.
InjectMacAddress bool
}
type IPXEHTTPScriptServer ¶
type IPXEHTTPScriptServer struct {
Enabled bool
Retries int
RetryDelay int
// OSIEURL is the IPv4 HookOS artifact base URL rendered into iPXE scripts.
OSIEURL *url.URL
// OSIEURLv6 is the IPv6 HookOS artifact base URL rendered into iPXE scripts.
OSIEURLv6 *url.URL
// ExtraKernelArgs is appended to the kernel cmdline for IPv4 machines.
ExtraKernelArgs []string
// ExtraKernelArgsV6 is appended to the kernel cmdline for IPv6 machines.
ExtraKernelArgsV6 []string
KernelName string
InitrdName string
// SyslogFQDN is the syslog hostname for IPv4 iPXE scripts and ISO images.
// If empty, it falls back to DHCP.SyslogIP.
SyslogFQDN string
// SyslogFQDNV6 is the syslog hostname or IPv6 address for DHCPv6 iPXE scripts.
// If empty, it falls back to DHCPv6.SyslogIP. Hostnames are resolved by iPXE at boot.
SyslogFQDNV6 string
}
type PXEHTTP ¶ added in v0.25.0
type PXEHTTP struct {
// Enabled is a flag to enable or disable serving over HTTP.
Enabled bool
// PathPrefix is the URL path prefix the assets are served under.
PathPrefix string
}
PXEHTTP configures serving pxelinux.cfg and the TFTP asset directory (TFTP.AssetDir) over Smee's HTTP server, for clients that netboot via HTTP (eg. u-boot's pxe-over-http, which uses wget) using the same request path shapes as TFTP.
type TFTP ¶
type TFTP struct {
// AssetDir is the directory from which to serve extra TFTP assets.
AssetDir string
// V4 and V6 are the per-family listen addresses.
V4 Bind
V6 Bind
// BlockSize is the block size to use when serving TFTP requests.
BlockSize int
// SinglePort configures whether to use single-port TFTP mode.
SinglePort bool
// Timeout is the timeout for each serving each TFTP request.
Timeout time.Duration
// Enabled is a flag to enable or disable the TFTP server.
Enabled bool
}
type TLS ¶ added in v0.22.0
type TLS struct {
Certs []tls.Certificate
}
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
bootstrap
Package bootstrap builds a Hardware's OSIE files into an uncompressed `newc` CPIO archive, which the kernel extracts as an additional initramfs, and serves it over HTTP.
|
Package bootstrap builds a Hardware's OSIE files into an uncompressed `newc` CPIO archive, which the kernel extracts as an additional initramfs, and serves it over HTTP. |
|
dhcp/dhcpv6/handler/reservation
Package reservation is the handler for responding to DHCPv6 messages with host reservations.
|
Package reservation is the handler for responding to DHCPv6 messages with host reservations. |
|
dhcp/dhcpv6/server
Package server provides DHCPv6 listening and serving functionality.
|
Package server provides DHCPv6 listening and serving functionality. |
|
dhcp/handler/proxy
Package proxy implements a DHCP handler that provides proxyDHCP functionality.
|
Package proxy implements a DHCP handler that provides proxyDHCP functionality. |
|
dhcp/handler/reservation
Package noop is a backend handler that does nothing.
|
Package noop is a backend handler that does nothing. |
|
dhcp/otel
Package otel handles translating DHCP headers and options to otel key/value attributes.
|
Package otel handles translating DHCP headers and options to otel key/value attributes. |
|
dhcp/server
Package dhcp providers UDP listening and serving functionality.
|
Package dhcp providers UDP listening and serving functionality. |
|
hardware
Package hardware provides hardware lookup against a tinkerbell backend.
|
Package hardware provides hardware lookup against a tinkerbell backend. |
|
ipxe/binary/file
Package binary handles embedding of the iPXE binaries.
|
Package binary handles embedding of the iPXE binaries. |