package plugin
import "k8s.io/kubernetes/pkg/kubelet/cm/dra/plugin"
Index ¶
- type DRAPlugin
- func (p *DRAPlugin) DriverName() string
- func (p *DRAPlugin) HealthStreamCancel() context.CancelFunc
- func (p *DRAPlugin) NodePrepareResources( ctx context.Context, req *drapbv1.NodePrepareResourcesRequest, opts ...grpc.CallOption, ) (*drapbv1.NodePrepareResourcesResponse, error)
- func (p *DRAPlugin) NodeUnprepareResources( ctx context.Context, req *drapbv1.NodeUnprepareResourcesRequest, opts ...grpc.CallOption, ) (*drapbv1.NodeUnprepareResourcesResponse, error)
- func (p *DRAPlugin) NodeWatchResources(ctx context.Context) (drahealthv1alpha1.DRAResourceHealth_NodeWatchResourcesClient, error)
- func (p *DRAPlugin) SetHealthStream(ctx context.Context, cancel context.CancelFunc)
- type DRAPluginManager
- func NewDRAPluginManager(ctx context.Context, kubeClient kubernetes.Interface, getNode func() (*v1.Node, error), streamHandler StreamHandler, wipingDelay time.Duration) *DRAPluginManager
- func (pm *DRAPluginManager) DeRegisterPlugin(driverName, endpoint string)
- func (pm *DRAPluginManager) GetPlugin(driverName string) (*DRAPlugin, error)
- func (pm *DRAPluginManager) RegisterPlugin(driverName string, endpoint string, supportedServices []string, pluginClientTimeout *time.Duration) error
- func (pm *DRAPluginManager) Stop()
- func (pm *DRAPluginManager) ValidatePlugin(driverName string, endpoint string, supportedServices []string) error
- type StreamHandler
Types ¶
type DRAPlugin ¶
type DRAPlugin struct {
// contains filtered or unexported fields
}
DRAPlugin contains information about one registered plugin of a DRA driver. It implements the kubelet operations for preparing/unpreparing by calling a gRPC interface that is implemented by the plugin.
func (*DRAPlugin) DriverName ¶
func (*DRAPlugin) HealthStreamCancel ¶
func (p *DRAPlugin) HealthStreamCancel() context.CancelFunc
HealthStreamCancel returns the cancel function for the current health stream, if any.
func (*DRAPlugin) NodePrepareResources ¶
func (p *DRAPlugin) NodePrepareResources( ctx context.Context, req *drapbv1.NodePrepareResourcesRequest, opts ...grpc.CallOption, ) (*drapbv1.NodePrepareResourcesResponse, error)
func (*DRAPlugin) NodeUnprepareResources ¶
func (p *DRAPlugin) NodeUnprepareResources( ctx context.Context, req *drapbv1.NodeUnprepareResourcesRequest, opts ...grpc.CallOption, ) (*drapbv1.NodeUnprepareResourcesResponse, error)
func (*DRAPlugin) NodeWatchResources ¶
func (p *DRAPlugin) NodeWatchResources(ctx context.Context) (drahealthv1alpha1.DRAResourceHealth_NodeWatchResourcesClient, error)
NodeWatchResources establishes a stream to receive health updates from the DRA plugin.
func (*DRAPlugin) SetHealthStream ¶
func (p *DRAPlugin) SetHealthStream(ctx context.Context, cancel context.CancelFunc)
SetHealthStream stores the context and cancel function for the active health stream.
type DRAPluginManager ¶
type DRAPluginManager struct {
// contains filtered or unexported fields
}
DRAPluginManager keeps track of how to reach plugins registered for DRA drivers. Each plugin has a gRPC endpoint. There may be more than one plugin per driver.
To be informed about available plugins, the DRAPluginManager implements the cache.PluginHandler interface and needs to be added to the plugin manager.
The null DRAPluginManager is not usable, use NewDRAPluginManager.
func NewDRAPluginManager ¶
func NewDRAPluginManager(ctx context.Context, kubeClient kubernetes.Interface, getNode func() (*v1.Node, error), streamHandler StreamHandler, wipingDelay time.Duration) *DRAPluginManager
NewDRAPluginManager creates a new DRAPluginManager, with support for wiping ResourceSlices when the plugin(s) for a DRA driver are not available too long.
The context can be used to cancel all background activities. If desired, Stop can be called in addition or instead of canceling the context. It then also waits for background activities to stop.
func (*DRAPluginManager) DeRegisterPlugin ¶
func (pm *DRAPluginManager) DeRegisterPlugin(driverName, endpoint string)
DeRegisterPlugin implements cache.PluginHandler.
The plugin manager calls it after it has detected that the plugin removed its registration socket, signaling that it is no longer available.
func (*DRAPluginManager) GetPlugin ¶
func (pm *DRAPluginManager) GetPlugin(driverName string) (*DRAPlugin, error)
GetPlugin returns a wrapper around those gRPC methods of a DRA driver kubelet plugin which need to be called by kubelet. The wrapper handles gRPC connection management and logging. Connections are reused across different calls.
It returns an informative error message including the driver name with an explanation why the driver is not usable.
func (*DRAPluginManager) RegisterPlugin ¶
func (pm *DRAPluginManager) RegisterPlugin(driverName string, endpoint string, supportedServices []string, pluginClientTimeout *time.Duration) error
RegisterPlugin implements cache.PluginHandler. It is called by the plugin manager when a plugin is ready to be registered.
Plugins of a DRA driver are required to register under the name of the DRA driver.
DRA uses the version array in the registration API to enumerate all gRPC services that the plugin provides, using the "<gRPC package name>.<service name>" format (e.g. "v1beta1.DRAPlugin"). This allows kubelet to determine in advance which version to use resp. which optional services the plugin supports.
func (*DRAPluginManager) Stop ¶
func (pm *DRAPluginManager) Stop()
Stop cancels any remaining background activities and blocks until all goroutines have stopped, with one caveat: goroutines created dynamically for wiping ResourceSlices are not tracked. They won't do anything because of the context cancellation.
func (*DRAPluginManager) ValidatePlugin ¶
func (pm *DRAPluginManager) ValidatePlugin(driverName string, endpoint string, supportedServices []string) error
ValidatePlugin implements cache.PluginHandler.
The plugin manager calls it upon detection of a new registration socket opened by DRA plugin.
type StreamHandler ¶
type StreamHandler interface { // HandleWatchResourcesStream processes health updates from a specific DRA plugin stream. HandleWatchResourcesStream(ctx context.Context, stream drahealthv1alpha1.DRAResourceHealth_NodeWatchResourcesClient, resourceName string) error }
StreamHandler defines the interface for handling DRA health streams. This interface is implemented by the DRA Manager to decouple the plugin package from the manager package, breaking the import cycle.
Source Files ¶
dra_plugin.go dra_plugin_manager.go types.go
- Version
- v1.34.0-rc.0
- Published
- Aug 6, 2025
- Platform
- linux/amd64
- Imports
- 29 packages
- Last checked
- 2 minutes ago –
Tools for package owners.