plugin

package
v1.35.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DRAPlugin added in v1.34.0

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 added in v1.34.0

func (p *DRAPlugin) DriverName() string

func (*DRAPlugin) HealthStreamCancel added in v1.34.0

func (p *DRAPlugin) HealthStreamCancel() context.CancelFunc

HealthStreamCancel returns the cancel function for the current health stream, if any.

func (*DRAPlugin) NodePrepareResources added in v1.34.0

func (*DRAPlugin) NodeUnprepareResources added in v1.34.0

func (*DRAPlugin) NodeWatchResources added in v1.34.0

NodeWatchResources establishes a stream to receive health updates from the DRA plugin.

func (*DRAPlugin) SetHealthStream added in v1.34.0

func (p *DRAPlugin) SetHealthStream(ctx context.Context, cancel context.CancelFunc)

SetHealthStream stores the context and cancel function for the active health stream.

type DRAPluginManager added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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 added in v1.34.0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL