v1beta1

package
v1.25.12 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect() error
	Run()
	Disconnect() error
}

func NewPluginClient

func NewPluginClient(r string, socketPath string, h ClientHandler) Client

type ClientHandler

type ClientHandler interface {
	PluginConnected(string, DevicePlugin) error
	PluginDisconnected(string)
	PluginListAndWatchReceiver(string, *api.ListAndWatchResponse)
}

type DevicePlugin

type DevicePlugin interface {
	Api() api.DevicePluginClient
	Resource() string
	SocketPath() string
}

type RegistrationHandler

type RegistrationHandler interface {
	CleanupPluginDirectory(string) error
}

type Server

type Server interface {
	cache.PluginHandler
	Start() error
	Stop() error
	SocketPath() string
}

func NewServer

func NewServer(socketPath string, rh RegistrationHandler, ch ClientHandler) (Server, error)

type Stub

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

Stub implementation for DevicePlugin.

func NewDevicePluginStub

func NewDevicePluginStub(devs []*pluginapi.Device, socket string, name string, preStartContainerFlag bool, getPreferredAllocationFlag bool) *Stub

NewDevicePluginStub returns an initialized DevicePlugin Stub.

func (*Stub) Allocate

Allocate does a mock allocation

func (*Stub) GetDevicePluginOptions

func (m *Stub) GetDevicePluginOptions(ctx context.Context, e *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

GetDevicePluginOptions returns DevicePluginOptions settings for the device plugin.

func (*Stub) GetInfo

GetInfo is the RPC which return pluginInfo

func (*Stub) GetPreferredAllocation

GetPreferredAllocation gets the preferred allocation from a set of available devices

func (*Stub) ListAndWatch

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

func (*Stub) NotifyRegistrationStatus

func (m *Stub) NotifyRegistrationStatus(ctx context.Context, status *watcherapi.RegistrationStatus) (*watcherapi.RegistrationStatusResponse, error)

NotifyRegistrationStatus receives the registration notification from watcher

func (*Stub) PreStartContainer

PreStartContainer resets the devices received

func (*Stub) Register

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

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

func (*Stub) SetAllocFunc

func (m *Stub) SetAllocFunc(f stubAllocFunc)

SetAllocFunc sets allocFunc of the device plugin

func (*Stub) SetGetPreferredAllocFunc

func (m *Stub) SetGetPreferredAllocFunc(f stubGetPreferredAllocFunc)

SetGetPreferredAllocFunc sets allocFunc of the device plugin

func (*Stub) Start

func (m *Stub) Start() error

Start starts the gRPC server of the device plugin. Can only be called once.

func (*Stub) Stop

func (m *Stub) Stop() error

Stop stops the gRPC server. Can be called without a prior Start and more than once. Not safe to be called concurrently by different goroutines!

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