driver

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxDevice added in v0.4.0

type LinuxDevice struct {
	Path     string
	Type     string
	Major    int64
	Minor    int64
	FileMode uint32
	UID      uint32
	GID      uint32
}

func GetDeviceInfo added in v0.4.0

func GetDeviceInfo(path string) (LinuxDevice, error)

GetDeviceInfo retrieves device type, major, and minor numbers for a given path. It returns an error if the path does not exist or if it's not a device file.

type NetworkDriver

type NetworkDriver struct {
	// contains filtered or unexported fields
}

func Start

func Start(ctx context.Context, driverName string, kubeClient kubernetes.Interface, nodeName string, opts ...Option) (*NetworkDriver, error)

func (*NetworkDriver) CreateContainer added in v0.4.0

func (np *NetworkDriver) CreateContainer(ctx context.Context, pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error)

CreateContainer handles container creation requests.

func (*NetworkDriver) HandleError added in v0.7.0

func (np *NetworkDriver) HandleError(ctx context.Context, err error, msg string)

func (*NetworkDriver) PrepareResourceClaims added in v0.4.0

func (np *NetworkDriver) PrepareResourceClaims(ctx context.Context, claims []*resourceapi.ResourceClaim) (map[types.UID]kubeletplugin.PrepareResult, error)

func (*NetworkDriver) PublishResources

func (np *NetworkDriver) PublishResources(ctx context.Context)

func (*NetworkDriver) RemovePodSandbox

func (np *NetworkDriver) RemovePodSandbox(ctx context.Context, pod *api.PodSandbox) error

func (*NetworkDriver) RunPodSandbox

func (np *NetworkDriver) RunPodSandbox(ctx context.Context, pod *api.PodSandbox) error

func (*NetworkDriver) Shutdown

func (np *NetworkDriver) Shutdown(_ context.Context)

func (*NetworkDriver) Stop

func (np *NetworkDriver) Stop()

func (*NetworkDriver) StopPodSandbox

func (np *NetworkDriver) StopPodSandbox(ctx context.Context, pod *api.PodSandbox) error

StopPodSandbox tries to move back the devices to the rootnamespace but does not fail to avoid disrupting the pod shutdown. The kernel will do the cleanup once the namespace is deleted.

func (*NetworkDriver) Synchronize

func (np *NetworkDriver) Synchronize(_ context.Context, pods []*api.PodSandbox, containers []*api.Container) ([]*api.ContainerUpdate, error)

func (*NetworkDriver) UnprepareResourceClaims added in v0.4.0

func (np *NetworkDriver) UnprepareResourceClaims(ctx context.Context, claims []kubeletplugin.NamespacedObject) (map[types.UID]error, error)

type OffloadFlagDefinition added in v0.5.0

type OffloadFlagDefinition struct {
	ShortName     string
	LongName      string
	KernelPattern string
}

off_flag_def https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/common.c#n51 OffloadFlagDefinition is the Go equivalent of the C struct off_flag_def. We keep this struct as the source of truth for building the map.

type Option

type Option func(*NetworkDriver)

func WithFilter added in v0.3.1

func WithFilter(filter cel.Program) Option

WithFilter

func WithInventory added in v0.9.0

func WithInventory(db inventoryDB) Option

WithInventory sets the inventory database for the driver.

type PodConfig added in v0.4.0

type PodConfig struct {
	Claim types.NamespacedName

	// NetworkInterfaceConfigInHost is the config of the network interface as
	// seen in the host's network namespace BEFORE it was moved to the pod's
	// network namespace.
	NetworkInterfaceConfigInHost apis.NetworkConfig

	// NetworkInterfaceConfigInPod contains all network-related configurations
	// (interface, routes, ethtool, sysctl) to be applied for this device in the
	// Pod's namespace.
	NetworkInterfaceConfigInPod apis.NetworkConfig

	// RDMADevice holds RDMA-specific configurations if the network device
	// has associated RDMA capabilities.
	RDMADevice RDMAConfig
}

PodConfig holds the set of configurations to be applied for a single network device allocated to a Pod. This includes network interface settings, routes for the Pod's network namespace, and RDMA configurations.

type PodConfigStore added in v0.4.0

type PodConfigStore struct {
	// contains filtered or unexported fields
}

PodConfigStore provides a thread-safe, centralized store for all network device configurations across multiple Pods. It is indexed by the Pod's UID, and for each Pod, it maps network device names (as allocated) to their specific Config.

func NewPodConfigStore added in v0.4.0

func NewPodConfigStore() *PodConfigStore

NewPodConfigStore creates and returns a new instance of PodConfigStore.

func (*PodConfigStore) DeleteClaim added in v0.4.0

func (s *PodConfigStore) DeleteClaim(claim types.NamespacedName)

DeleteClaim removes all configurations associated with a given claim.

func (*PodConfigStore) DeletePod added in v0.4.0

func (s *PodConfigStore) DeletePod(podUID types.UID)

DeletePod removes all configurations associated with a given Pod UID.

func (*PodConfigStore) Get added in v0.4.0

func (s *PodConfigStore) Get(podUID types.UID, deviceName string) (PodConfig, bool)

Get retrieves the configuration for a specific device under a given Pod UID. It returns the Config and true if found, otherwise an empty Config and false.

func (*PodConfigStore) GetPodConfigs added in v0.4.0

func (s *PodConfigStore) GetPodConfigs(podUID types.UID) (map[string]PodConfig, bool)

GetPodConfigs retrieves all device configurations for a given Pod UID. It is indexed by the Pod's UID, and for each Pod, it maps network device names (as allocated) to their specific Config.

func (*PodConfigStore) Set added in v0.4.0

func (s *PodConfigStore) Set(podUID types.UID, deviceName string, config PodConfig)

Set stores the configuration for a specific device under a given Pod UID. If a configuration for the Pod UID or device name already exists, it will be overwritten.

type RDMAConfig added in v0.4.0

type RDMAConfig struct {
	// LinkDev is the name of the RDMA link device (e.g., "mlx5_0") that
	// corresponds to the allocated network device.
	LinkDev string

	// DevChars is a list of user-space RDMA character
	// devices (e.g., "/dev/infiniband/uverbs0", "/dev/infiniband/rdma_cm")
	// that should be made available to the Pod.
	DevChars []LinuxDevice
}

RDMAConfig contains parameters for setting up an RDMA device associated with a network interface.

Jump to

Keyboard shortcuts

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