Documentation ¶
Index ¶
- func IsDeviceName(k v1.ResourceName) bool
- func IsResourceNameValid(resourceName string) error
- type Manager
- type ManagerImpl
- func (m *ManagerImpl) Allocate(resourceName string, devs []string) (*pluginapi.AllocateResponse, error)
- func (m *ManagerImpl) CheckpointFile() string
- func (m *ManagerImpl) Devices() map[string][]*pluginapi.Device
- func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error)
- func (m *ManagerImpl) Start() error
- func (m *ManagerImpl) Stop() error
- type MonitorCallback
- type Stub
- func (m *Stub) Allocate(ctx context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (m *Stub) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error
- func (m *Stub) Register(kubeletEndpoint, resourceName string) error
- func (m *Stub) Start() error
- func (m *Stub) Stop() error
- func (m *Stub) Update(devs []*pluginapi.Device)
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 ¶
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 ¶
func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error)
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 ¶
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 ¶
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) ListAndWatch ¶
ListAndWatch lists devices and update that list according to the Update call