kubernetesk8s.io/kubernetes/pkg/kubelet/cm/dra/plugin Index | Files

package plugin

import "k8s.io/kubernetes/pkg/kubelet/cm/dra/plugin"

Index

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 (p *DRAPlugin) DriverName() string

func (*DRAPlugin) NodePrepareResources

func (*DRAPlugin) NodeUnprepareResources

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 NewPluginManager.

func NewDRAPluginManager

func NewDRAPluginManager(ctx context.Context, kubeClient kubernetes.Interface, getNode func() (*v1.Node, error), 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.

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.

Source Files

dra_plugin.go dra_plugin_manager.go

Version
v1.34.0-alpha.1
Published
Jun 16, 2025
Platform
js/wasm
Imports
23 packages
Last checked
4 minutes ago

Tools for package owners.