deviceplugin

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PluginConfig added in v0.0.2

type PluginConfig struct {
	LogFile  string
	LogLevel string
}

PluginConfig is the object that represents the overall plugin config. Global configurations such as log levels are contained here.

func GetPluginConfig added in v0.0.2

func GetPluginConfig(configFile string) (PluginConfig, error)

GetPluginConfig returns the global config for the device plugin. This config is returned in a PluginConfig object

type PoolConfig

type PoolConfig struct {
	Name                    string                        // the name of the pool, used for logging and advertising resource to K8s. Pods will request this resource
	Mode                    string                        // the mode that this pool operates in
	Devices                 map[string]*networking.Device // a map of devices that the pool will manage
	Filters                 []string                      // the ethtool/rss filters we apply to devices from this pool
	UdsServerDisable        bool                          // a boolean to say if pods in this pool require BPF loading the UDS server
	UdsTimeout              int                           // timeout value in seconds for the UDS sockets, user provided or defaults to value from constants package
	UdsFuzz                 bool                          // a boolean to turn on fuzz testing within the UDS server, has no use outside of development and testing
	RequiresUnprivilegedBpf bool                          // a boolean to say if this pool requires unprivileged BPF
	UID                     int                           // the id of the pod user, we give this user ACL access to the UDS socket
	EthtoolCmds             []string                      // list of ethtool filters to apply to the netdev
}

PoolConfig is the object representing the config of an individual device pool. It contains pool specific details, such as mode and the device list. This object is passed into the PoolManager.

func GetPoolConfigs added in v0.0.2

func GetPoolConfigs(configFile string, net networking.Handler, host host.Handler) ([]PoolConfig, error)

GetPoolConfigs returns a slice of PoolConfig objects. Each object containing the config and device list for one pool.

type PoolManager

type PoolManager struct {
	Name             string
	Mode             string
	Devices          map[string]*networking.Device
	UpdateSignal     chan bool
	DpAPISocket      string
	DpAPIEndpoint    string
	UdsServerDisable bool
	UdsTimeout       int
	DevicePrefix     string
	UdsFuzz          bool
	UID              string
	EthtoolFilters   []string
	DpAPIServer      *grpc.Server
	ServerFactory    udsserver.ServerFactory
	BpfHandler       bpf.Handler
	NetHandler       networking.Handler
}

PoolManager represents an manages the pool of devices. Each PoolManager registers with Kubernetes as a different device type.

func NewPoolManager added in v0.0.2

func NewPoolManager(config PoolConfig) PoolManager

func (*PoolManager) Allocate

Allocate is part of the device plugin API. Called during container creation so that the Device Plugin can run device specific operations and instruct Kubelet of the steps to make the Device available in the container.

func (*PoolManager) GetDevicePluginOptions

func (pm *PoolManager) GetDevicePluginOptions(context.Context, *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

GetDevicePluginOptions is part of the device plugin API. Unused.

func (*PoolManager) GetPreferredAllocation

GetPreferredAllocation is part of the device plugin API. Unused.

func (*PoolManager) Init

func (pm *PoolManager) Init(config PoolConfig) error

Init is called it initialise the PoolManager.

func (*PoolManager) ListAndWatch

func (pm *PoolManager) ListAndWatch(empty *pluginapi.Empty,
	stream pluginapi.DevicePlugin_ListAndWatchServer) error

ListAndWatch is part of the device plugin API. Returns a stream list of Devices. Whenever a device state changes, ListAndWatch should return the new list.

func (*PoolManager) PreStartContainer

PreStartContainer is part of the device plugin API. Unused.

func (*PoolManager) Terminate

func (pm *PoolManager) Terminate() error

Terminate is called it terminate the PoolManager.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL