Documentation ¶
Index ¶
- type Client
- type ClientHandler
- type DevicePlugin
- type RegistrationHandler
- type Server
- type Stub
- func (m *Stub) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (m *Stub) GetDevicePluginOptions(ctx context.Context, e *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
- func (m *Stub) GetInfo(ctx context.Context, req *watcherapi.InfoRequest) (*watcherapi.PluginInfo, error)
- func (m *Stub) GetPreferredAllocation(ctx context.Context, r *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error)
- func (m *Stub) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error
- func (m *Stub) NotifyRegistrationStatus(ctx context.Context, status *watcherapi.RegistrationStatus) (*watcherapi.RegistrationStatusResponse, error)
- func (m *Stub) PreStartContainer(ctx context.Context, r *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
- func (m *Stub) Register(kubeletEndpoint, resourceName string, pluginSockDir string) error
- func (m *Stub) Restart() error
- func (m *Stub) SetAllocFunc(f stubAllocFunc)
- func (m *Stub) SetGetPreferredAllocFunc(f stubGetPreferredAllocFunc)
- func (m *Stub) SetRegisterControlFunc(f stubRegisterControlFunc)
- func (m *Stub) Start() error
- func (m *Stub) Stop() error
- func (m *Stub) Update(devs []*pluginapi.Device)
- func (m *Stub) Watch(kubeletEndpoint, resourceName, pluginSockDir string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
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 ¶
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 ¶
func (m *Stub) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
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 ¶
func (m *Stub) GetInfo(ctx context.Context, req *watcherapi.InfoRequest) (*watcherapi.PluginInfo, error)
GetInfo is the RPC which return pluginInfo
func (*Stub) GetPreferredAllocation ¶
func (m *Stub) GetPreferredAllocation(ctx context.Context, r *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error)
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 ¶
func (m *Stub) PreStartContainer(ctx context.Context, r *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
PreStartContainer resets the devices received
func (*Stub) Register ¶
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) SetRegisterControlFunc ¶ added in v1.29.0
func (m *Stub) SetRegisterControlFunc(f stubRegisterControlFunc)
SetRegisterControlFunc sets RegisterControlFunc of the device plugin
func (*Stub) Stop ¶
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!