deviceplugin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package deviceplugin provides functions to start a device plugin service

Package deviceplugin provides functions to start a device plugin service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CcDevice

type CcDevice struct {
	v1beta1.Device
	DeviceSpecs []*v1beta1.DeviceSpec
	Mounts      []*v1beta1.Mount
	// Limit specifies the cap number of workloads sharing a worker node
	Limit int
}

CcDevice wraps the v1.beta1.Device type, which has hostPath, containerPath and permission

type CcDevicePlugin

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

CcDevicePlugin is a device plugin for cc devices

func (*CcDevicePlugin) Allocate

Allocate assigns cc devices to a Pod.

func (*CcDevicePlugin) GetDevicePluginOptions

func (cdp *CcDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *v1beta1.Empty) (*v1beta1.DevicePluginOptions, error)

GetDevicePluginOptions returns options to be communicated with Device Manager. Currently it always returns an empty response until plugin options are implemented.

func (*CcDevicePlugin) GetPreferredAllocation

GetPreferredAllocation returns a preferred set of devices to allocate from a list of available ones. It is only designed to help the devicemanager make a more informed allocation decision when possible. It is not needed for cc device plugin, thus always returns an empty response.

func (*CcDevicePlugin) ListAndWatch

ListAndWatch lists all devices and then refreshes every deviceCheckInterval.

func (*CcDevicePlugin) PreStartContainer

PreStartContainer is called, if indicated by Device Plugin during registration phase, before each container start. Device plugin can run device specific operations such as resetting the device before making devices available to the container. It is not needed for cc device plugin, thus always returns an empty response.

type CcDeviceSpec

type CcDeviceSpec struct {
	Resource         string
	DevicePaths      []string
	MeasurementPaths []string
}

CcDeviceSpec defines a cc device type and the paths at which it can be found.

type Plugin

type Plugin interface {
	v1beta1.DevicePluginServer
	Run(context.Context) error
}

Plugin is a Kubernetes device plugin that can be run.

func NewCcDevicePlugin

func NewCcDevicePlugin(cds *CcDeviceSpec, devicePluginPath string, socket string, logger log.Logger, reg prometheus.Registerer) (Plugin, error)

NewCcDevicePlugin creates a new plugin for a cc device.

func NewPlugin

func NewPlugin(resource, devicePluginPath string, socket string, kubeSocketBase string, dps v1beta1.DevicePluginServer, logger log.Logger, reg prometheus.Registerer) Plugin

NewPlugin creates a new instance of a device plugin.

Jump to

Keyboard shortcuts

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