v1beta1

package
v1.29.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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
}

Client interface provides methods for establishing/closing gRPC connection and running the device plugin gRPC client.

func NewPluginClient

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

NewPluginClient returns an initialized device plugin client.

type ClientHandler

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

ClientHandler is an interface for handling device plugin connections.

type DevicePlugin

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

DevicePlugin interface provides methods for accessing Device Plugin resources, API and unix socket.

type RegistrationHandler

type RegistrationHandler interface {
	CleanupPluginDirectory(string) error
}

RegistrationHandler is an interface for handling device plugin registration and plugin directory cleanup.

type Server

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

Server interface provides methods for Device plugin registration server.

func NewServer

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

NewServer returns an initialized device plugin registration server.

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) Restart added in v1.29.0

func (m *Stub) Restart() error

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) SetRegisterControlFunc added in v1.29.0

func (m *Stub) SetRegisterControlFunc(f stubRegisterControlFunc)

SetRegisterControlFunc sets RegisterControlFunc 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

func (*Stub) Watch added in v1.29.0

func (m *Stub) Watch(kubeletEndpoint, resourceName, pluginSockDir string)

Jump to

Keyboard shortcuts

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