Documentation ¶
Overview ¶
Package deviceplugin provides API for reporting available devices to kubelet.
Index ¶
Constants ¶
const ( CDIVersion = "0.5.0" // Kubernetes 1.27 / CRI-O 1.27 / Containerd 1.7 use this version. CDIDir = "/var/run/cdi" CDIVendor = "intel.cdi.k8s.io" )
Server state.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶ added in v0.21.0
type Allocator interface { // Allocate allows the plugin to replace the server Allocate(). Plugin can return // UseDefaultAllocateMethod if the default server allocation is anyhow preferred // for the particular allocation request. Allocate(*pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error) }
Allocator is an optional interface implemented by device plugins.
type ContainerPreStarter ¶ added in v0.18.0
type ContainerPreStarter interface { // PreStartContainer defines device initialization function before container is started. // It might include operations like card reset. PreStartContainer(*pluginapi.PreStartContainerRequest) error }
ContainerPreStarter is an optional interface implemented by device plugins.
type DeviceInfo ¶
type DeviceInfo struct {
// contains filtered or unexported fields
}
DeviceInfo contains information about device maintained by Device Plugin.
func NewDeviceInfo ¶ added in v0.17.0
func NewDeviceInfo(state string, nodes []pluginapi.DeviceSpec, mounts []pluginapi.Mount, envs, annotations map[string]string, cdiSpec *cdispec.Spec) DeviceInfo
NewDeviceInfo makes DeviceInfo struct and adds topology information to it.
func NewDeviceInfoWithTopologyHints ¶ added in v0.22.0
func NewDeviceInfoWithTopologyHints(state string, nodes []pluginapi.DeviceSpec, mounts []pluginapi.Mount, envs map[string]string, annotations map[string]string, topology *pluginapi.TopologyInfo, cdiSpec *cdispec.Spec) DeviceInfo
NewDeviceInfoWithTopologyHints makes DeviceInfo struct with topology information provided to it.
type DeviceTree ¶
type DeviceTree map[string]map[string]DeviceInfo
DeviceTree contains a tree-like structure of device type -> device ID -> device info.
func NewDeviceTree ¶
func NewDeviceTree() DeviceTree
NewDeviceTree creates an instance of DeviceTree.
func (DeviceTree) AddDevice ¶
func (tree DeviceTree) AddDevice(devType, id string, info DeviceInfo)
AddDevice adds device info to DeviceTree.
func (DeviceTree) DeviceTypeCount ¶ added in v0.25.0
func (tree DeviceTree) DeviceTypeCount(devType string) int
DeviceTypeCount returns number of device of given type.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages life cycle of device plugins and handles the scan results received from them.
func NewManager ¶
NewManager creates a new instance of Manager.
type Notifier ¶
type Notifier interface { // Notify notifies manager with a device tree constructed by device // plugin during scanning process. Notify(DeviceTree) }
Notifier receives updates from Scanner, detects changes and sends the detected changes to a channel given by the creator of a Notifier object.
type PostAllocator ¶
type PostAllocator interface { // PostAllocate modifies responses returned by Allocate() by e.g. // adding annotations consumed by CRI hooks to the responses. PostAllocate(*pluginapi.AllocateResponse) error }
PostAllocator is an optional interface implemented by device plugins.
type PreferredAllocator ¶ added in v0.20.0
type PreferredAllocator interface { // GetPreferredAllocation defines the list of devices preferred for allocating next. GetPreferredAllocation(*pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) }
PreferredAllocator is an optional interface implemented by device plugins.
type Scanner ¶
type Scanner interface { // Scan scans the host for devices and sends all found devices to // a Notifier instance. It's called only once for every device plugin by // Manager in a goroutine and operates in an infinite loop. Scan(Notifier) error }
Scanner serves as an interface between Manager and a device plugin.
type UseDefaultMethodError ¶ added in v0.21.0
type UseDefaultMethodError struct{}
UseDefaultMethodError allows the plugin to request running the default logic even while implementing an optional interface. This is currently supported only with the Allocator interface.
func (*UseDefaultMethodError) Error ¶ added in v0.21.0
func (e *UseDefaultMethodError) Error() string