Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the init container logic. It reads the input config, discovers DPUs on the node, and waits for required PFs to have the requested functions ready (VFs and/or SFs). Once ready, it generates the upstream device plugin config using rootDevices with range syntax and writes it to disk.
Types ¶
type DPUInfo ¶
type DPUInfo struct {
// SerialNumber is the DPU serial number.
SerialNumber string
// BaseAddress is the PCI base address without function number (e.g., "0000:b1:00").
BaseAddress string
// PFs is the map of PF index to PF info. Only contains PFs referenced in the config.
PFs map[int32]*PFInfo
// DevicePluginResourcesConfig is the list of device plugin resources configuration for this DPU.
DevicePluginResourcesConfig []noderesourcesv1.DevicePluginResource
}
DPUInfo contains information about a discovered DPU on the local node.
type DevicePluginConfig ¶
type DevicePluginConfig struct {
ResourceList []ResourceConfig `json:"resourceList"`
}
DevicePluginConfig is the upstream SR-IOV network device plugin configuration format. See: https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin
type Options ¶
type Options struct {
// InputPath is the path to the input config file (downward API mounted).
InputPath string
// OutputPath is the path to the output config directory.
OutputPath string
// DefaultResourcePrefix is the default resource prefix for resources that don't specify one.
DefaultResourcePrefix string
// DevicesReadinessTimeout is the timeout for discovering DPUs and waiting for functions to be ready.
DevicesReadinessTimeout time.Duration
// DevicesReadinessPollInterval is the interval for polling for DPUs and functions to be ready.
DevicesReadinessPollInterval time.Duration
// SysFSRoot is the path to the sysfs root directory (default: /sys).
SysFSRoot string
// Clock is the clock to use for time-based operations (default: clock.RealClock{}).
Clock clock.WithTicker
}
Options contains the configuration options for the init container.
type PFInfo ¶
type PFInfo struct {
// Address is the PCI address of the PF (e.g., "0000:b1:00.0").
Address string
// TotalVFs is the maximum number of VFs supported by this PF (from sriov_totalvfs).
TotalVFs int32
}
PFInfo contains information about a Physical Function.
type ResourceConfig ¶
type ResourceConfig struct {
// ResourceName is the name of the resource (without prefix).
ResourceName string `json:"resourceName"`
// ResourcePrefix is the prefix for the resource name (e.g., "nvidia.com").
ResourcePrefix string `json:"resourcePrefix,omitempty"`
// DeviceType is the sriov-network-device-plugin device type.
// Empty for VFs (netDevice default). "auxNetDevice" for SFs.
DeviceType string `json:"deviceType,omitempty"`
// Selectors is a list of device selectors. Each selector typically represents
// devices from a single DPU.
Selectors []Selector `json:"selectors,omitempty"`
}
ResourceConfig defines a single resource in the device plugin configuration.
type Selector ¶
type Selector struct {
// RootDevices is a list of PF PCI addresses with function range syntax.
// Format: "<PF_PCI_ADDRESS>#<start>-<end>" (e.g., "0000:b1:00.0#2-10").
RootDevices []string `json:"rootDevices,omitempty"`
// AuxTypes filters auxiliary devices. Set to ["sf"] for Scalable Functions.
AuxTypes []string `json:"auxTypes,omitempty"`
// IsRdma indicates whether RDMA is enabled.
IsRdma bool `json:"isRdma,omitempty"`
// NeedVhostNet mounts /dev/vhost-net and /dev/net/tun with the device.
NeedVhostNet bool `json:"needVhostNet,omitempty"`
}
Selector defines device selectors for a group of functions (typically from one DPU).