kubeletplugin

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Overview

Package kubeletplugin provides helper functions for running a dynamic resource allocation kubelet plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DRAPlugin

type DRAPlugin interface {
	// Stop ensures that all spawned goroutines are stopped and frees
	// resources.
	Stop()

	// RegistrationStatus returns the result of registration, nil if none
	// received yet.
	RegistrationStatus() *registerapi.RegistrationStatus
	// contains filtered or unexported methods
}

DRAPlugin gets returned by Start and defines the public API of the generic dynamic resource allocation plugin.

func Start

func Start(nodeServer interface{}, opts ...Option) (result DRAPlugin, finalErr error)

Start sets up two gRPC servers (one for registration, one for the DRA node client). By default, all APIs implemented by the nodeServer get registered.

type Option

type Option func(o *options) error

Option implements the functional options pattern for Start.

func DriverName

func DriverName(driverName string) Option

DriverName defines the driver name for the dynamic resource allocation driver. Must be set.

func GRPCInterceptor

func GRPCInterceptor(interceptor grpc.UnaryServerInterceptor) Option

GRPCInterceptor is called for each incoming gRPC method call. This option may be used more than once and each interceptor will get called.

func GRPCStreamInterceptor added in v0.30.0

func GRPCStreamInterceptor(interceptor grpc.StreamServerInterceptor) Option

GRPCStreamInterceptor is called for each gRPC streaming method call. This option may be used more than once and each interceptor will get called.

func GRPCVerbosity

func GRPCVerbosity(level int) Option

GRPCVerbosity sets the verbosity for logging gRPC calls. Default is 4. A negative value disables logging.

func KubeletPluginSocketPath

func KubeletPluginSocketPath(path string) Option

KubeletPluginSocketPath defines how kubelet will connect to the dynamic resource allocation plugin. This corresponds to PluginSocketPath, except that PluginSocketPath defines the path in the filesystem of the caller and KubeletPluginSocketPath in the filesystem of kubelet.

func Logger

func Logger(logger klog.Logger) Option

Logger overrides the default klog.Background logger.

func NodeV1alpha2 added in v0.28.0

func NodeV1alpha2(enabled bool) Option

NodeV1alpha2 explicitly chooses whether the DRA gRPC API v1alpha2 gets enabled.

func NodeV1alpha3 added in v0.28.0

func NodeV1alpha3(enabled bool) Option

NodeV1alpha2 explicitly chooses whether the DRA gRPC API v1alpha3 gets enabled.

func PluginListener

func PluginListener(listener net.Listener) Option

PluginListener sets an already created listener for the dynamic resource allocation plugin API. Can be combined with PluginSocketPath.

At least one of these two options is required.

func PluginSocketPath

func PluginSocketPath(path string) Option

PluginSocketPath sets the file path for a Unix domain socket. If PluginListener is not used, then Start will remove a file at that path, should one exist, and creates a socket itself. Otherwise it uses the provided listener and only removes the socket at the specified path during shutdown.

At least one of these two options is required.

func RegistrarListener

func RegistrarListener(listener net.Listener) Option

RegistrarListener sets an already created listener for the plugin registrarion API. Can be combined with RegistrarSocketPath.

At least one of these two options is required.

func RegistrarSocketPath

func RegistrarSocketPath(path string) Option

RegistrarSocketPath sets the file path for a Unix domain socket. If RegistrarListener is not used, then Start will remove a file at that path, should one exist, and creates a socket itself. Otherwise it uses the provided listener and only removes the socket at the specified path during shutdown.

At least one of these two options is required.

Jump to

Keyboard shortcuts

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