Documentation
¶
Index ¶
- Constants
- func MetricsRegistry() *prometheus.Registry
- type BackendReader
- type Config
- func (c *Config) BinaryHandler(log logr.Logger) http.Handler
- func (c *Config) ISOHandler(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 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" // 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/" )
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 Config ¶
type Config struct {
// Backend is the backend to use for getting data.
Backend BackendReader
// DHCP is the configuration for the DHCP service.
DHCP DHCP
// 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. 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) ISOHandler ¶ added in v0.23.0
ISOHandler returns an http.Handler that serves patched ISO images. 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
// 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 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 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
// BindAddr is the local address to which to bind the TFTP server.
BindAddr netip.Addr
// BindPort is the local port to which to bind the TFTP server.
BindPort uint16
// 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
}
type TinkServer ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
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. |