deviceplugin

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Overview

Package deviceplugin provides API for reporting available devices to kubelet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 map[string]string) DeviceInfo

NewDeviceInfo makes DeviceInfo struct and adds topology information 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.

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