Documentation ¶
Overview ¶
Package deviceplugin provides functions to start a device plugin service
Package deviceplugin provides functions to start a device plugin service
Index ¶
- type CcDevice
- type CcDevicePlugin
- func (cdp *CcDevicePlugin) Allocate(_ context.Context, req *v1beta1.AllocateRequest) (*v1beta1.AllocateResponse, error)
- func (cdp *CcDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *v1beta1.Empty) (*v1beta1.DevicePluginOptions, error)
- func (cdp *CcDevicePlugin) GetPreferredAllocation(context.Context, *v1beta1.PreferredAllocationRequest) (*v1beta1.PreferredAllocationResponse, error)
- func (cdp *CcDevicePlugin) ListAndWatch(_ *v1beta1.Empty, stream v1beta1.DevicePlugin_ListAndWatchServer) error
- func (cdp *CcDevicePlugin) PreStartContainer(_ context.Context, _ *v1beta1.PreStartContainerRequest) (*v1beta1.PreStartContainerResponse, error)
- type CcDeviceSpec
- type Plugin
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 ¶
func (cdp *CcDevicePlugin) Allocate(_ context.Context, req *v1beta1.AllocateRequest) (*v1beta1.AllocateResponse, error)
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 ¶
func (cdp *CcDevicePlugin) GetPreferredAllocation(context.Context, *v1beta1.PreferredAllocationRequest) (*v1beta1.PreferredAllocationResponse, error)
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 ¶
func (cdp *CcDevicePlugin) ListAndWatch(_ *v1beta1.Empty, stream v1beta1.DevicePlugin_ListAndWatchServer) error
ListAndWatch lists all devices and then refreshes every deviceCheckInterval.
func (*CcDevicePlugin) PreStartContainer ¶
func (cdp *CcDevicePlugin) PreStartContainer(_ context.Context, _ *v1beta1.PreStartContainerRequest) (*v1beta1.PreStartContainerResponse, error)
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 ¶
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.