deviceplugin

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceInfo

type DeviceInfo struct {
	State  string
	Nodes  []pluginapi.DeviceSpec
	Mounts []pluginapi.Mount
	Envs   map[string]string
}

DeviceInfo contains information about device maintained by Device Plugin

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.

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

func NewManager(namespace string, devicePlugin Scanner) *Manager

NewManager creates a new instance of Manager

func (*Manager) Run

func (m *Manager) Run()

Run prepares and launches event loop for updates from Scanner

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 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.

Jump to

Keyboard shortcuts

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