deviceplugin

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDeviceName

func IsDeviceName(k v1.ResourceName) bool

IsDeviceName returns whether the ResourceName points to an extended resource name exported by a device plugin.

func IsResourceNameValid

func IsResourceNameValid(resourceName string) error

IsResourceNameValid returns an error if the resource is invalid or is not an extended resource name.

Types

type Manager

type Manager interface {
	// Start starts the gRPC Registration service.
	Start() error

	// Devices is the map of devices that have registered themselves
	// against the manager.
	// The map key is the ResourceName of the device plugins.
	Devices() map[string][]*pluginapi.Device

	// Allocate takes resourceName and list of device Ids, and calls the
	// gRPC Allocate on the device plugin matching the resourceName.
	Allocate(string, []string) (*pluginapi.AllocateResponse, error)

	// Stop stops the manager.
	Stop() error

	// Returns checkpoint file path.
	CheckpointFile() string
}

Manager manages all the Device Plugins running on a node.

type ManagerImpl

type ManagerImpl struct {
	// contains filtered or unexported fields
}

ManagerImpl is the structure in charge of managing Device Plugins.

func NewManagerImpl

func NewManagerImpl(socketPath string, f MonitorCallback) (*ManagerImpl, error)

NewManagerImpl creates a new manager on the socket `socketPath`. f is the callback that is called when a device becomes unhealthy. socketPath is present for testing purposes in production this is pluginapi.KubeletSocket

func (*ManagerImpl) Allocate

func (m *ManagerImpl) Allocate(resourceName string, devs []string) (*pluginapi.AllocateResponse, error)

Allocate is the call that you can use to allocate a set of devices from the registered device plugins.

func (*ManagerImpl) CheckpointFile

func (m *ManagerImpl) CheckpointFile() string

CheckpointFile returns device plugin checkpoint file path.

func (*ManagerImpl) Devices

func (m *ManagerImpl) Devices() map[string][]*pluginapi.Device

Devices is the map of devices that are known by the Device Plugin manager with the kind of the devices as key

func (*ManagerImpl) Register

Register registers a device plugin.

func (*ManagerImpl) Start

func (m *ManagerImpl) Start() error

Start starts the Device Plugin Manager

func (*ManagerImpl) Stop

func (m *ManagerImpl) Stop() error

Stop is the function that can stop the gRPC server.

type MonitorCallback

type MonitorCallback func(resourceName string, added, updated, deleted []*pluginapi.Device)

MonitorCallback is the function called when a device's health state changes, or new devices are reported, or old devices are deleted. Updated contains the most recent state of the Device.

type Stub

type Stub struct {
	// contains filtered or unexported fields
}

Stub implementation for DevicePlugin.

func NewDevicePluginStub

func NewDevicePluginStub(devs []*pluginapi.Device, socket string) *Stub

NewDevicePluginStub returns an initialized DevicePlugin Stub.

func (*Stub) Allocate

Allocate does a mock allocation

func (*Stub) ListAndWatch

ListAndWatch lists devices and update that list according to the Update call

func (*Stub) Register

func (m *Stub) Register(kubeletEndpoint, resourceName string) error

Register registers the device plugin for the given resourceName with Kubelet.

func (*Stub) Start

func (m *Stub) Start() error

Start starts the gRPC server of the device plugin

func (*Stub) Stop

func (m *Stub) Stop() error

Stop stops the gRPC server

func (*Stub) Update

func (m *Stub) Update(devs []*pluginapi.Device)

Update allows the device plugin to send new devices through ListAndWatch

Jump to

Keyboard shortcuts

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