Documentation ¶
Index ¶
- Constants
- Variables
- type AccelDevice
- type AccelDeviceSelectors
- type DeviceInfoProvider
- type DeviceProvider
- type DeviceSelector
- type DeviceSelectors
- type DeviceType
- type LinkWatcher
- type NadUtils
- type NetDeviceSelectors
- type PciDevice
- type PciNetDevice
- type RdmaSpec
- type ResourceConfList
- type ResourceConfig
- type ResourceFactory
- type ResourcePool
- type ResourceServer
Constants ¶
const (
// KubeEndPoint is kubelet socket name
KubeEndPoint = "kubelet.sock"
)
Variables ¶
var ( // SockDir is the default Kubelet device plugin socket directory SockDir = "/var/lib/kubelet/plugins_registry" // DeprecatedSockDir is the deprecated Kubelet device plugin socket directory DeprecatedSockDir = "/var/lib/kubelet/device-plugins" )
var SupportedDevices = map[DeviceType]int{ NetDeviceType: 0x02, AcceleratorType: 0x12, }
SupportedDevices is map of 'device identifier as string' to 'device class hexcode as int'
Supported PCI Device Classes. ref: https://pci-ids.ucw.cz/read/PD 02 Network controller 12 Processing accelerators
Network controller subclasses. ref: https://pci-ids.ucw.cz/read/PD/02 00 Ethernet controller 01 Token ring network controller 02 FDDI network controller 03 ATM network controller 04 ISDN controller 05 WorldFip controller 06 PICMG controller 07 Infiniband controller 08 Fabric controller 80 Network controller
Processing accelerators subclasses. ref: https://pci-ids.ucw.cz/read/PD/12 00 Processing accelerators 01 AI Inference Accelerator
Functions ¶
This section is empty.
Types ¶
type AccelDeviceSelectors ¶
type AccelDeviceSelectors struct {
DeviceSelectors
}
AccelDeviceSelectors contains accelerator(FPGA etc.) related selectors fields
type DeviceInfoProvider ¶
type DeviceInfoProvider interface { GetDeviceSpecs() []*pluginapi.DeviceSpec GetEnvVal() string GetMounts() []*pluginapi.Mount }
DeviceInfoProvider is an interface to get Device Plugin API specific device information
type DeviceProvider ¶
type DeviceProvider interface { // AddTargetDevices adds a list of devices in a DeviceProvider that matches the 'device class hexcode as int' AddTargetDevices([]*ghw.PCIDevice, int) error GetDiscoveredDevices() []*ghw.PCIDevice // GetDevices runs through the Discovered Devices and returns a list of fully populated PciDevices according to the given ResourceConfig GetDevices(*ResourceConfig) []PciDevice GetFilteredDevices([]PciDevice, *ResourceConfig) ([]PciDevice, error) }
DeviceProvider provides interface for device discovery
type DeviceSelector ¶
DeviceSelector provides an interface for filtering a list of devices
type DeviceSelectors ¶
type DeviceSelectors struct { Vendors []string `json:"vendors,omitempty"` Devices []string `json:"devices,omitempty"` Drivers []string `json:"drivers,omitempty"` PciAddresses []string `json:"pciAddresses,omitempty"` }
DeviceSelectors contains common device selectors fields
type DeviceType ¶
type DeviceType string
DeviceType is custom type to define supported device types
const ( // NetDeviceType is DeviceType for network class devices NetDeviceType DeviceType = "netDevice" // AcceleratorType is DeviceType for accelerator class devices AcceleratorType DeviceType = "accelerator" )
type LinkWatcher ¶
type LinkWatcher interface {
Subscribe()
}
LinkWatcher in interface to watch Network link status
type NadUtils ¶
type NadUtils interface { SaveDeviceInfoFile(resourceName string, deviceID string, devInfo *nettypes.DeviceInfo) error CleanDeviceInfoFile(resourceName string, deviceID string) error }
NadUtils is an interface for Network-Attachment-Definition utilities
type NetDeviceSelectors ¶
type NetDeviceSelectors struct { DeviceSelectors PfNames []string `json:"pfNames,omitempty"` RootDevices []string `json:"rootDevices,omitempty"` LinkTypes []string `json:"linkTypes,omitempty"` DDPProfiles []string `json:"ddpProfiles,omitempty"` IsRdma bool // the resource support rdma NeedVhostNet bool // share vhost-net along the selected resource }
NetDeviceSelectors contains network device related selectors fields
type PciDevice ¶
type PciDevice interface { GetVendor() string GetDriver() string GetDeviceCode() string GetPciAddr() string GetPfPciAddr() string IsSriovPF() bool GetSubClass() string GetDeviceSpecs() []*pluginapi.DeviceSpec GetEnvVal() string GetMounts() []*pluginapi.Mount GetAPIDevice() *pluginapi.Device GetVFID() int GetNumaInfo() string }
PciDevice provides an interface to get generic device specific information
type PciNetDevice ¶
type PciNetDevice interface { PciDevice GetPFName() string GetNetName() string GetLinkSpeed() string GetLinkType() string GetRdmaSpec() RdmaSpec GetDDPProfiles() string }
PciNetDevice extends PciDevice interface
type RdmaSpec ¶
type RdmaSpec interface { IsRdma() bool GetRdmaDeviceSpec() []*pluginapi.DeviceSpec }
RdmaSpec rdma device data
type ResourceConfList ¶
type ResourceConfList struct {
ResourceList []ResourceConfig `json:"resourceList"` // config file: "resourceList" :[{<ResourceConfig configs>},{},{},...]
}
ResourceConfList is list of ResourceConfig
type ResourceConfig ¶
type ResourceConfig struct { // optional resource prefix that will overwrite global prefix specified in cli params ResourcePrefix string `json:"resourcePrefix,omitempty"` ResourceName string `json:"resourceName"` // the resource name will be added with resource prefix in K8s api DeviceType DeviceType `json:"deviceType,omitempty"` Selectors *json.RawMessage `json:"selectors,omitempty"` SelectorObj interface{} }
ResourceConfig contains configuration parameters for a resource pool
type ResourceFactory ¶
type ResourceFactory interface { GetResourceServer(ResourcePool) (ResourceServer, error) GetDefaultInfoProvider(string, string) DeviceInfoProvider GetSelector(string, []string) (DeviceSelector, error) GetResourcePool(rc *ResourceConfig, deviceList []PciDevice) (ResourcePool, error) GetRdmaSpec(string) RdmaSpec GetDeviceProvider(DeviceType) DeviceProvider GetDeviceFilter(*ResourceConfig) (interface{}, error) GetNadUtils() NadUtils }
ResourceFactory is an interface to get instances of ResourcePool and ResourceServer
type ResourcePool ¶
type ResourcePool interface { // extended API for internal use GetResourceName() string GetResourcePrefix() string GetDevices() map[string]*pluginapi.Device // for ListAndWatch Probe() bool GetDeviceSpecs(deviceIDs []string) []*pluginapi.DeviceSpec GetEnvs(deviceIDs []string) []string GetMounts(deviceIDs []string) []*pluginapi.Mount StoreDeviceInfoFile(resourceNamePrefix string) error CleanDeviceInfoFile(resourceNamePrefix string) error }
ResourcePool represents a generic resource entity
type ResourceServer ¶
type ResourceServer interface { // Device manager API pluginapi.DevicePluginServer // grpc server related Start() error Stop() error // Init initializes resourcePool Init() error // Watch watches for socket file deletion and restart server if needed Watch() }
ResourceServer is gRPC server implements K8s device plugin api